-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdirectives.js
57 lines (50 loc) · 1.51 KB
/
directives.js
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
app.directive('status', function () {
return {
restrict: 'E',
template: '<span>{{status}}</span>',
link: function (scope) {
// Use ($)scope.status to print to console log and add a message to the screen.
scope.$watch('status', function (value) {
if (value !== undefined) {
console.log(value);
}
});
}
};
})
.directive('connection', function () {
return {
restrict: 'E',
templateUrl: 'connection-interface.html'
};
})
.directive('cards', function () {
return {
restrict: 'E',
templateUrl: 'cards.html'
};
})
.directive('card', function () {
return {
restrict: 'E',
scope: {
data: '='
},
// to have nested templates one needs to use the templateCache
templateUrl: 'card.html',
controller: function ($scope, GameEvents) {
$scope.chooseProperty = function (propertyName) {
$scope.$emit(GameEvents.PROPERTY_CHOSEN, propertyName);
};
},
link: function (scope, element) {
element.addClass('card-directive');
}
};
})
.directive('scores', function () {
return {
restrict: 'E',
templateUrl: 'scores.html'
};
});