gpt4 book ai didi

ember.js - 从子路线替换父 View

转载 作者:行者123 更新时间:2023-12-04 13:49:42 25 4
gpt4 key购买 nike

在这里我的问题Nested routes in Ember之后,我想将/settings/users/呈现的 View 替换为/settings/users/1呈现的 View 。

我的路线定义为:

Router.map(function() {
this.route('login');
this.resource('settings', { path: 'settings/:settings_id' }, function() {
this.route('overview');
this.route('users', function() {
this.route('user', { path: ':user_id' });
});
});
});

user.hbs包含 users.hbs时,我的 {{outlet}}模板将呈现。我希望 user.hbs代替不在其中的 users.hbs呈现。

最佳答案

将您的users模板更改为一个 socket

{{outlet}}

并将用户模板中的内容放到 users/index模板中,然后仅当您在 users路线上时才会显示,而当您更深入时,它不会显示索引路线。
Cool stuff in the users index template

示例: http://emberjs.jsbin.com/jacebeyira/1/edit?html,js,output

关于ember.js - 从子路线替换父 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27738130/

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