diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-11-07 17:14:29 +0100 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-11-07 17:14:29 +0100 |
commit | 262e9218cbbc8cef1539c0a20b774d7aa3871b32 (patch) | |
tree | b861de2b739af48ef6a61058873f305a62aa6511 /js/public/script.js | |
parent | 98cee330babd893531ee5cf0ab1a26ae712a1cb9 (diff) |
fix find function being in array
Diffstat (limited to 'js/public/script.js')
-rw-r--r-- | js/public/script.js | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/js/public/script.js b/js/public/script.js index 85a4d36e..be39ffed 100644 --- a/js/public/script.js +++ b/js/public/script.js @@ -65,7 +65,22 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur }); }]); - +app.controller('addressbookCtrl', function() { + var ctrl = this; + console.log(this); +}); +app.directive('addressbook', function() { + return { + restrict: 'A', // has to be an attribute to work with core css + scope: {}, + controller: 'addressbookCtrl', + controllerAs: 'ctrl', + bindToController: { + addressBook: "=data" + }, + templateUrl: OC.linkTo('contactsrework', 'templates/addressBook.html') + }; +}); app.controller('addressbooklistCtrl', ['$scope', 'AddressBookService', function(scope, AddressBookService) { var ctrl = this; @@ -133,22 +148,6 @@ app.directive('contactlist', function() { templateUrl: OC.linkTo('contactsrework', 'templates/contactList.html') }; }); -app.controller('addressbookCtrl', function() { - var ctrl = this; - console.log(this); -}); -app.directive('addressbook', function() { - return { - restrict: 'A', // has to be an attribute to work with core css - scope: {}, - controller: 'addressbookCtrl', - controllerAs: 'ctrl', - bindToController: { - addressBook: "=data" - }, - templateUrl: OC.linkTo('contactsrework', 'templates/addressBook.html') - }; -}); app.factory('AddressBook', function() { return function AddressBook(data) { @@ -254,15 +253,18 @@ app.service('AddressBookService', ['DavClient', 'DavService', 'AddressBook', 'Co // parse contacts addressBook.contacts = []; for(var i in addressBook.objects) { - addressBook.contacts.push( - new Contact(addressBook.objects[i]) - ); + if(typeof addressBook.objects[i] === 'object') { + addressBook.contacts.push( + new Contact(addressBook.objects[i]) + ); + } } return addressBook; }); }; }]); + app.service('ContactService', [ 'DavClient', function(DavClient) { this.create = function(addressBook) { |