javascript - Ember.js Rest Adapter: mapping JSON with no root (.NET Web API) -
i have existing service written .net web api.
as example, service returns json in following format:
[ { "id": 1, "name": "john" }, { "id": 2, "name": "jane" } ]
however, per ember.js rest adapter documentation, ember expect json in following format:
{ "persons": [ { "id": 1, "name": "john" }, { "id": 2, "name": "jane" } ] }
because of this, ember returning following error: your server returned hash key 0 have no mapping it
by no means plan on changing service api , how returns data.
would possible ember.js (latest version) work existing data service returning? and, if so, how can implement that?
ember flexible in sense, giving ability extend adapter , serializer in order integrate app backend api.
you should webapiadapter, part of ember.js template web api.
additionally, might wanna take this project wrote example, based on same template (with modifications did on own). it's still under development , doesn't feature best practices (yet), i'd it's valid example.
you should take repo / library (you can install via nuget too), allows pre-compile handlebars templates directly ember.templates
collection.
Comments
Post a Comment