プロパティ名を変更できない場合は、モデル オブジェクトで計算されたプロパティを使用できます。http://jsfiddle.net/pangratz666/4ZQM8/を参照してください。
ハンドルバー:
<script type="text/x-handlebars" >
<ul>
{{#each App.controller}}
<li>{{actionProp}}</li>
{{/each}}
</ul>
</script>
JavaScript :
App.Object = Ember.Object.extend({
actionProp: function() {
return this.get('action');
}.property('action')
});
App.controller = Ember.ArrayController.create({
content: [],
addObj: function(number) {
this.pushObject(App.Object.create({
action: number
}));
}
});
カスタム モデル オブジェクトがない場合は、CollectionView で計算されたプロパティを使用できます。http://jsfiddle.net/pangratz666/r6XAc/を参照してください。
ハンドルバー:
<script type="text/x-handlebars" data-template-name="item" >
{{actionProp}}
</script>
JavaScript :
Ember.CollectionView.create({
contentBinding: 'App.controller',
itemViewClass: Ember.View.extend({
templateName: 'item',
actionProp: function(){
return this.getPath('content.action');
}.property()
})
}).append();