-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard-controller.js
More file actions
58 lines (47 loc) · 1.58 KB
/
dashboard-controller.js
File metadata and controls
58 lines (47 loc) · 1.58 KB
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
/**
*
*/
var dashboardApp = angular.module('dashboardApp', []);
dashboardApp.controller("colorCodingController", ['$scope', '$http', function($scope, $http){
$scope.saveRule = function(){
console.log("Saving rule");
};
$scope.discard = function(){
console.log("Discarding rule");
$("#rulesContainer").html("");
$("#editModal").modal("hide");
};
}]);
/*dashboardApp.directive("addbuttons", function($compile){
return function(scope, element, attrs){
element.bind("click", function(){
scope.count++;
angular.element(document.getElementById('rulesContainer')).append($compile("<div><button class='btn btn-default' data-alert="+scope.count+">Show alert #"+scope.count+"</button></div>")(scope));
});
};
});*/
dashboardApp.directive("addNewRow", function($compile){
return function(scope, element, attrs){
element.bind("click", function(){
angular.element(document.getElementById('rulesContainer')).append(
$compile('<div class="ruleRow"><button class="btn btn-primary btn-round" style="margin-bottom: 5px;" add-rule><span class="glyphicon glyphicon-plus"></span></button></div>')(scope));
});
};
});
dashboardApp.directive("addRule", function($compile, $scope){
return function(scope, element, attrs){
element.bind("click", function(){
console.log(element.parent());
angular.element(element.parent()).append($compile('<rule></rule>')(scope));
});
};
});
dashboardApp.directive("rule", function(){
return{
restrict: "E",
templateUrl: "templates/directives/rule.php",
controller: function(){
console.log("Called");
}
};
});