问题
I am defining a resource as explained here:
App.Router.map(function () {
this.resource('phones', { path: '/nodes/extensions/phones' }, function () {
this.route('new');
});
But this is not working. Finding the phones
performs a request to /phones
instead of using the configured value /nodes/extensions/phones
. What am I doing wrong?
回答1:
The path
here is the path used in the browser address bar, e.g. a user would access "http://yoursite.com/#/nodes/extensions/phones" to see this page on your site.
If instead you want to configure the endpoint that the Ember app accesses to retrieve the json, e.g. "http://yoursite.com/api/nodes/extensions/phones" then that needs to be configured in your ember-data adapter or in your model's data retrieval functions.
回答2:
i'm not sure, but going by the first example under the link you provided, it seems like the path only determines what you type in the address bar while 'phones' determines the route that is addressed. so changing 'phones' to 'nodes.extensions.phones' could maybe help.
来源:https://stackoverflow.com/questions/15812438/mapping-route-to-a-explicit-path-does-not-work