mardi 23 décembre 2014

How to use two adapter(LS and Rest adapter) to a model(Foo - ModelName), but route based access/use the adapter in ember.js application?

When I use the LS adapter to Foo model in first page, I defined/mentioned the DS.LSAdapter to that Foo model and get the model data from database to the local storage. after I can access/manage the model data using by local storage adapter in the first page. It is working fine here.


Next I will navigate to second page and this page model is defined/mentioned the Rest Adapter for Foo same model. Ember does not make REST API call here, because the problem is first LS adapter initiated in the first page and this second page is not initiate the REST adapter for that Foo model. How do we initiate the rest the adapter to Foo model in second page without page refresh?


Please you give the solution to fix it. Thank you so much.


Model


App.Foo = DS.Model.extend({ id: DS.attr('id'), name: DS.attr('string') });


Mention the Local Storage Adapter in first page


App.FooAdapter = DS.LSAdapter.extend({ namespace: 'ls-emberjs' });


Mention the Rest Adapter in second page


App.FooAdapter = DS.RESTAdapter.extend({


});


Thanks





Aucun commentaire:

Enregistrer un commentaire