Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

let $resource keep data until new response data has arrived #1737

Closed
@konsultaner

Description

@konsultaner

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions