Javascript [EmberJS]:在子模板中获取所选模型
我是Ember的新手,希望在子控制器/模板中获得选定的模型值 我有一个侧边栏,列出了工作区。每当有人单击工作区时,应用程序将路由到Javascript [EmberJS]:在子模板中获取所选模型,javascript,ember.js,Javascript,Ember.js,我是Ember的新手,希望在子控制器/模板中获得选定的模型值 我有一个侧边栏,列出了工作区。每当有人单击工作区时,应用程序将路由到工作区/:slug,并显示连接到该特定工作区的任务列表 我想在子路径中显示选定的工作区名称。我该怎么做呢 我的路由器看起来是这样的: App.Router.map(function() { this.route('login'); this.resource('workspaces', function() { this.route('ta
工作区/:slug
,并显示连接到该特定工作区的任务列表
我想在子路径中显示选定的工作区名称
。我该怎么做呢
我的路由器看起来是这样的:
App.Router.map(function() {
this.route('login');
this.resource('workspaces', function() {
this.route('tasks', {path: ':slug'});
});
});
我在网上读了很多东西,但还没弄明白
谢谢。
:slug
是您的动态片段。您可以访问模型中的动态段,如下所示:
App.WorkspacesTasksRoute = Ember.Route.extend({
model: function(param) {
return { name: param.slug };
}
});
参见一个正在工作的jsbin示例slug是工作区的名称吗?@KalmanHazins是/例如,工作区/我的工作区。