0
我有作为应用路线('/'
)内限定的/newLicense
路线:如何在EmberJS的子模板中使用父模板的属性?
App.Router.map(function() {
this.route('newLicense', {path: '/newLicense'});
});
我有称为is_admin
它获取适当地设定每个应用控制器被调用时应用控制器的特性。现在在newLicense
模板中,我想根据登录用户是否为admin(它存储在应用程序控制器的is_admin
中)显示一条消息。
我试图
{{#if is_admin}}
<p> You are logged in as Admin user. </p>
{{else}}
<p> You are logged in as Read-Only user. </p>
{{/if}}
但它不工作。我也试图在newLicenseController
提供应用程序控制器:
App.newLicenseController = Ember.ObjectController.extend({
needs: ['application'],
});
但它仍然没有工作。然后我尝试{{#if application.is_admin}}
仍然没有运气。
对这个概念的任何帮助非常感谢。谢谢。