diff --git a/js/script.js b/js/script.js index 809bd47..4592e29 100644 --- a/js/script.js +++ b/js/script.js @@ -32,7 +32,17 @@ app.controller('OcSmsController', ['$scope', $.post(OC.generateUrl('/apps/ocsms/set/country'),{'country': $('select[name=intl_phone]').val()}); }; $scope.loadConversation = function () { - alert('loadConversation'); + //@TODO + }; + $scope.replaceContacts = function (ctList) { + $scope.$apply(function () { + $scope.contacts = ctList; + }); + }; + $scope.addContact = function (ct) { + $scope.$apply(function () { + $scope.contacts.push(ct); + }); }; } ]); @@ -297,6 +307,8 @@ function fetchInitialPeerList(jsondata) { var bufferedContacts = []; + var aScope = angular.element('[ng-controller="OcSmsController"]').scope(); + $.each(jsondata['phonelist'], function(id, val) { var fn, peerLabel, idxVal; idxVal = id.replace(/\//g,' '); @@ -310,21 +322,12 @@ function fetchInitialPeerList(jsondata) { peerLabel = fn; } if ($.inArray(peerLabel, bufferedContacts) == -1) { - peerListBuf += '