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}}
仍然沒有運氣。
對這個概念的任何幫助非常感謝。謝謝。