Mapping route to a explicit path does not work

江枫思渺然 提交于 2019-12-25 04:07:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!