Hi,
In my app, I want to show list of contacts. I use the find on the contact plugin but I do not know how to simply refresh the view after getting the result.
Is there a way to refresh the list based on the new content of my list ?
For info, here the view list
<ion-view title="Title">
<ion-content class="has-header">
<ion-list>
<ion-item ng-repeat="c in contacts" class="item item-button-right" type="item-text-wrap" >
{{ c.contact }} : {{ c.tel }} [{{c.type}}]
</ion-item>
</ion-list>
</ion-content>
</ion-view>
And the part of the controller which load the list :
//Create a demo list
$scope.contacts = [ { "contact":'Test', "tel":'lala', "type":"work" } ];
var o = new ContactFindOptions();
o.filter = "";
o.multiple = true;
navigator.contacts.find(
[navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name], // fields
function(col) {
angular.forEach(col, function(c) {
angular.forEach(c.phoneNumbers, function(p) {
$scope.contacts.push(
{ "contact": c.displayName, "tel": p.value, "type": p.type }
);
}; // /angular.ForEach
}); // /angulare.ForEach
alert($scope.contacts.length);
},
function(e) { alert(e); }, // error
o
);
I find that I can use a refresher and broadcast refreshComplete but is there a way to avoid it … I do not need the pull refresh.
Thanks