gpt4 book ai didi

ember.js - 如何在Ember 1.11.0中为 Ember 路线命名空间

转载 作者:行者123 更新时间:2023-12-02 06:03:09 24 4
gpt4 key购买 nike

我的理解是Ember 1.11.0在路由器中弃用了resource,而只赞成使用route。根据我所读的内容,两者之间的区别在于resource创建了 namespace 。另请:What is the difference between a route and resource in New Router API?

因此,问题是如何为路由命名空间,以便在下面的示例中,我的注释Route,Controller和View不以“Posts”为前缀?

App.Router.map(function() {
this.route("posts", { path: "/" }, function() {
this.route("new", { path: "/new" });
this.route("comments", { path: "/comments" }, function() {
this.route("new", { path: "/new" });
});
});
});

最佳答案

尝试将resetNamespace: true传递给类似这样的路线

this.route("comments", { path: "/comments", resetNamespace: true }, function() {
this.route("new", { path: "/new" });
});

关于ember.js - 如何在Ember 1.11.0中为 Ember 路线命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30301937/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com