我为我的应用程序定义了Router.map。我正在使用EmberJS AppKit架构。 https://github.com/stefanpenner/ember-app-kit

我想使用以下路径访问我的页面“个人资料”:
http://localhost:8000/#/profile

但是,我的路线名称与此路径不同,因为它称为user-profile,所以我这样做了:

router.js

var Router = Ember.Router.extend();

Router.map(function () {
    this.resource('user-profile', { path: 'profile'}, function() {
        //Some other things...
    });
});

export default Router;


user-profile.js

export default Ember.Route.extend({
    model: function () {
        return this.store.find('user-profile');
    }
});


当我启动我的应用程序时,Ember告诉我profile路由不存在,即使我定义了路径也是如此:

Uncaught Error: Assertion Failed: Error: Assertion Failed: The URL '/profile' did not match any routes in your application

您知道此时我的代码有什么问题吗?

谢谢

最佳答案

我不使用ember appkit,但也许尝试使用下划线,即'user_profile'并重命名您的文件。在黑暗中只是一枪。

关于javascript - EmberJS:更改路径以访问路线,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23527299/

10-12 06:35