You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
If you use the $resource service for getting data like a menu in combination with the $routeProvider service you need to request the data for the menu whenever the path changes, which causes the menu to blink.
It would be awesome if the $resource service would keep its data collected from the last request until the next comes in.
Actually, I think using a caching strategy like you have is exactly how it should be done. It's trivial to manage this in your own code, so it's better to keep it out of the core of Angular, if possible to allow for flexibility. But that's just my opinion!
I share the @jtymes opinion here. On top of this I don't see much point of using $resource here, $http would be better suited for this (based on the attached jsFiddle and the problem description). And BTW $http supports caching.
Closing this for now, please seek the support on the mailing list if still need help.
If you use the $resource service for getting data like a menu in combination with the $routeProvider service you need to request the data for the menu whenever the path changes, which causes the menu to blink.
It would be awesome if the $resource service would keep its data collected from the last request until the next comes in.
problem illustrated on jsFiddle: http://jsfiddle.net/4FfYb/3/
I had to solve the problem like this with an additional cache, which is probably not the right way to go, but it worked:
if ( angular.isArray( $scope.resourceObject)){
for(var i in cache){
$scope.resourceObject [i] = cache[i];
}
}else{
angular.extend( $scope.resourceObject ,cache);
}
The text was updated successfully, but these errors were encountered: