12162cc1
Geoffrey PREUD'HOMME
Liste de conversa...
|
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
|
angular.module('ForumDirCtrl', ['SessionsServ', 'ForumServ', 'NotifyServ']).controller('ForumDirCtrl', ['$scope', 'SessionServ', 'ForumServ', 'NotifyServ',
function ($scope, SessionServ, ForumServ, NotifyServ) {
$scope.convs = [];
$scope.formData = {};
$scope.session = SessionServ.cur;
SessionServ.onChange(function () {
$scope.session = SessionServ.cur;
});
ForumServ.getConvs(function(err, convs) {
if (!err)
$scope.convs = convs;
});
$scope.createConv = function () {
ForumServ.createConv($scope.formData, function(err, conv) {
if (!err)
$scope.convs.push(conv);
});
};
$scope.deleteConv = function (index) {
ForumServ.deleteConv($scope.convs[index]._id, function(err) {
if (!err)
$scope.convs.splice(index, 1);
});
};
}
]);
|