I am developing an application in the Ionic framework, which displays all the contacts from the device to the end user and gives the ability to select contacts. I use the ngCordova $ cordovaContacts module to select contacts.
This is a utility code that retrieves contacts from a device.
angular.module('starter.services').factory('ContactManager', function($cordovaContacts, $ionicLoading){
return {
getContacts: function() {
$ionicLoading.show({ template: "<div class='ion-ios7-reloading'></div>"});
var options = {};
options.filter = "";
options.multiple = true;
options.fields = ['displayName', 'name', 'phoneNumbers', 'emails'];
return $cordovaContacts.find(options);
}
}
});
Below is the controller code that assigns contacts to the $ scope.contacts variable
angular.module('starter.ctrls').controller('ShareCtrl', function($scope, ContactManager, $stateParams) {
$scope.contacts = [];
ContactManager.getContacts().then(function(_result){
alert("CONTACTS FETCHED: Now rendering in Template");
$scope.contacts = _result;
}, function(_error){
alert("Error: " + _error);
});
});
100-400 .
1000 ( CONTACTS FETCHED 2-3 ). 2-3 ( ng-repeat), .
, ngCordova.
Android-, , 1000.
?
angular .