My controller:
.controller('ECtrl', function($scope, EService){
$scope.events = []; // init events as empty array
EService.getAll().then(function (response) {
$scope.events = response;
console.log($scope.events);
$scope.doRefresh = function() {
$scope.events.push('Incoming todo ' + Math.random());
$scope.$broadcast('scroll.refreshComplete');
$scope.$apply()
};
})
console : Uncaught TypeError: $scope.events.push is not a function
{{ event.conteudo }}
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
I already tried to solve this problem but til now nothing so I want to know How can bind the $scope.events from my controller with a doRefresh() function? please I need a example code. thanks
In your template put it inside
<ion-refresher pulling-text="Pull to refresh" on-refresh="doRefresh()"></ion-refresher>
In conteroller
$scope.doRefresh = function() {
// here refresh data code
$scope.$broadcast('scroll.refreshComplete');
$scope.$apply()
};