-
Notifications
You must be signed in to change notification settings - Fork 22
Home
Amiel Martin edited this page Dec 18, 2015
·
11 revisions
ember-data-url-templates is an ember addon to allow building urls with url templates instead of
defining buildURL
(as described in RFC #4).
Url templates are compiled with geraintluff/uri-templates, which fully implements RFC 6570.
- Installation / Getting Started
- URI Template Format
- [[Custom
urlSegment
s|Custom-urlSegments]]
// adapters/comment
import Ember from "ember";
import DS from "ember-data";
import UrlTemplates from "ember-data-url-templates";
const { inject, computed } = Ember;
export default DS.RESTAdapter.extend(UrlTemplates, {
urlTemplate: '{+host}/comments{/id}',
createRecordUrlTemplate: '{+host}/users/{userId}/comments',
session: inject.service(),
urlSegments: {
userId() {
return this.get('session.userId'),
},
}
});