Skip to content

issue with shared model plugin and search/fetch #208

Description

@jasonayre

Im not sure if this is a bug or just my misusing the api heres the scenario:

Basically, what Im trying to do can be reproduced if you call search twice on a model that is using the shared_model plugin. For instance:

module.controller('ContactsIndexController', function($scope, Contact) {

  $scope.collection  = Contact.$search();
  $scope.collection = Contact.$search();

  // also for further sake of example the following yields the same results 
  // Contact.$search().$then(function(result){
  //  $scope.collection = this;
  // });
  // Contact.$search().$then(function(result){
  //  $scope.collection = this;
  // });
});

The issue is on second call of search, the shared model plugin is finding the model in cache when decoding, but then mysteriously seems to not return the actual found result back the the main collection array.

The above is not a good example but, basically the real issue Im having is, when I move to another sibling level state into my application, lets say from contacts.index to dashboard.index, then back to contacts.index, which instantiates a brand new controller, it calls contact.search again, and it wont return the actual search results since theyve been cached but for some reason, although decode is returning the result, its not being added back into the collection.

Am I missing something, or is there a better way to do the above? Or is this a bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions