1
如何在ArrayController.content []屬性內顯示數組中的特定項目?我有下面這段代碼:在Controller.content []數組內顯示第一個項目
App.View.PairView = Em.View.create({
templateName: 'display-template',
controller: App.Controller.PairController
});
App.Controller.PairController = Em.ArrayController.create({
content: [],
createNew: function(){
var weeks = ['1','2','3'];
var quarters = ['Q1', 'Q2', 'Q3'];
var months = ['Jan', 'Sep', 'Dec'];
this.set('content', []);
this.pushObject(weeks);
this.pushObject(quarters);
this.pushObject(months);
}
});
我只想得到App.Controller.PairController.content [0] [0]或 「周」。我如何寫下如果我有下面的把手模板?
<script type="text/x-handlebars" data-template-name="display-template">
{{#each item in controller}}
???????????????????????
{{/each}}
</script>
謝謝。