diff options
Diffstat (limited to 'alias-angular/app/js/controllers.js')
| -rw-r--r-- | alias-angular/app/js/controllers.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js new file mode 100644 index 0000000..4199c7f --- /dev/null +++ b/alias-angular/app/js/controllers.js @@ -0,0 +1,21 @@ +'use strict'; +/* App Controllers */ + +function RosterCtl($scope, connection) { + $scope.contacts = []; + $scope.init = function() { + var query = $iq({type : 'get'}).c('query', {xmlns : Strophe.NS.ROSTER}); + connection.sendIQ(query, success); + }; + $scope.onRoster = function(iq) { + var elems = iq.getElementsByTagName('query'); + var query = elems[0]; + Strophe.forEachChild(query, 'item', function(item){ + var jid = item.getAttribute('jid'); + var name = item.getAttribute('name') || jid; + $scope.contacts.push(name); + }); + return true; + }; +}; +RosterCtl.$inject = ['$scope','connection'];
\ No newline at end of file |
