Reputation: 143
I have a list where you can pull down to refresh. This event is fired inside a directive that handles the detection of the pullable list, the element looks like this.
<div class="pull-to-refresh" pulldown="update()">
//The list goes here
</div>
So in the directive, I detect the pulldown movement (with iscroll) and when released I call the function:
function pullDownAction(){
scope.$eval(attr.pulldown);
}
The update() function in the controller looks like this:
$scope.update = function () {
$http.get('/myurl/')
.success(function(data){
$scope.model = data;
});
};
Since updating from angular 1.1.1 to 1.1.4, the request no longer gets made. The function is called, but the request is not made. However, I can call the update() function straight from the view and it works, like so:
<button ng-click="update()">Click to update</button>
But, when called from the directive, it goes into the function, but the request is not made. I have looked through the changelog, but havent found anything that would cause this behaviour, and it works fine in angular 1.1.1. Does anyone have a clue as to what the problem might be?
Upvotes: 1
Views: 331
Reputation: 4737
1.1.4 currently requires to do the $http.get
in $scope.$apply
(don't know this is a bug).
since ng-click
does $scope.apply
for you, in your directive you have to do this manualy.
AFAIK scope.$eval does not trigger $digest, so try $scope.$apply(attrs.pulldown)
;
Upvotes: 4