vendredi 24 juin 2016

Ember - Custom adapter and serializer for multiple models

I am using RESTAdapter and RESTSerializer for integrating rest service in my ember project. I am able to do the rest service operation with the default ApplicationAdapter(Extend RESTAdapter) and I am able to create custom adapter for specific models.

I want to create a custom adapter which can be used for some specific set of models.

example,

//Application adapter extends RESTAdapter

var LookupAdapter = ApplicationAdapter.extend({
   host: Properties.LookupServiceHost,
   namespace : Properties.LookupServiceNamespace,
});

export default LookupAdapter;

I have some models like country, language etc. For fetching and populating data in data store, now I am using separate adapter, serializer(for handling request, response) for each model. I want those specific models to be worked with LookupAdapter. Can we assign this adapter to model anyway so that these models will use the LookupAdapter/LookupSerializer?




Aucun commentaire:

Enregistrer un commentaire