Question

I have created a model that is populated locally on the client, upon initializing the application.

The findQuery method always does an ajax request, for example:

App.store.find(App.Person, {name: 'John'})

even in the case where an App.Person with name:John has already been loaded. The find method which takes an id, looks at the local storage first. But I need to be able to perform queries by attribute.

My question is whether there exists a method for performing queries strictly on locally available data.

Was it helpful?

Solution

Use the DS.Store#filter method. A basic example is shown in the README on https://github.com/emberjs/data, section Filtering Loaded Records.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top