-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·62 lines (50 loc) · 2.23 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html ng-app="mermaidDemo">
<!--[if lt IE 7]> <html lang="en" ng-app="mermaidDemo" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="mermaidDemo" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="mermaidDemo" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="mermaidDemo" class="no-js"> <!--<![endif]-->
<head>
<title>Mermaid-Angular Demo</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link href="http://fonts.googleapis.com/css?family=Cookie|Open+Sans:400,700" rel="stylesheet" />
</head>
<body>
<div class="jumbotron">
<h2>Mermaid+Angular</h2><h3> Demo</h3>
</div>
<div class="view-frame" ng-controller="NodeListController">
<p> Click the node to add it to the list, a delay of 2s (2000) is used to illustrate the redraw, typically a much smaller value can be used
<ul class="list-group">
<li ng-repeat="node in nodes" class="list-group-item" ng-click="addToRun({name: 'Node_'+node})">
<span class="label label-info"> Node {{node}} </span></br>
</li>
</ul>
<div class="well mermaid" ng-bind-html="getGraph()"></div>
</div>
<script src="js/angular.min.js"></script>
<script src="js/angular-sanitize.min.js"></script>
<script src="js/mermaid.min.js"></script>
<script>
var refreshTime = 2000;
var mermaidDemo = angular.module('mermaidDemo', ['mermaidControllers']);
var myac = angular.module('mermaidControllers', ['ngSanitize']);
myac.controller('NodeListController', ['$scope','$sce', function($scope, $sce) {
$scope.nodes = [1,2,3,4,5]
$scope.graphScript = ""
$scope.addToRun = function(s) {
$scope.graphScript+=" Start-->"+s.name+"; ";
setTimeout(function(){mermaid.init();},2000)
};
$scope.getGraph = function() {
if($scope.graphScript.length>0) {
var gs = "graph TD; " + $scope.graphScript
return $sce.trustAsHtml(gs);
} else {
return "";
}
}
}]);
</script>
</body>
</html>