I am using a 3rd party js library to make http requests to their api. I perform this operation on every keystroke in an input field using "ng-keyup". After the call to there api returns I set the $scope.results which populates the view. However the view always updates one iteration behind, debugging this looks to be with the async call.
Is there a way to refresh the view or make the async call differently rather than just a callback?
Looks like your callback might be executing outside of angular context. Try calling $scope.$apply()
in async callback. If that's not the issue, post some code please :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.