Parent: [146b7d] (diff)

Download this file

directives.js    40 lines (36 with data), 1.1 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
'use strict';
angular.module('tut.c2net')
.directive('applicationTest', function(applicationMenuTemplateBuilder) {
return {
retrict: 'E',
replace: true,
template: applicationMenuTemplateBuilder('/#/notifications', 'mdi-bell', 'Notifications')
};
})
.directive('tutExternalUserNotification', function() {
return {
restrict: 'E',
replace: true,
scope: {
notification: '='
},
templateUrl: '/c2net/views/notification.html',
controller: function($scope, userNotificationAPI){
$scope.openUrl = function(url,id){
window.open(url,'_self');
setAsRead(id);
}
var setAsRead = function(id) {
userNotificationAPI
.setRead(id, true)
.then(function() {
console.log('Successfully setting ' + id + ' as read');
$scope.notification.read = true;
}, function(err) {
console.log('Error setting ' + id + ' as read: ' + err);
})
.finally(function() {});
};
}
};
});