我在emblem.js模板中有以下代码:
each line_items itemController=lineItem
.line_item.row-fluid.popover_link id="line_item_#{unbound id}" click="lineItemSelected" class={selected ordered}
.span8
= product.name
if notSingleItem
span.quantity   X #{quantity}
模特:
App.LineItem = DS.Model.extend
quantity: DS.attr 'number'
#this is duplicated for a reason
product_price: DS.attr 'number'
order: DS.belongsTo 'Cluey.Order'
product: DS.belongsTo 'Cluey.Product'
total: Ember.computed ->
@get('quantity') * @get('product_price')
.property('quantity', 'product_price')
notSingleItem: Ember.computed ->
@get('quantity') != 1
.property('quantity')
div_id: Ember.computed ->
"line_item_" + @get('id')
.property()
ordered: DS.attr 'boolean', { defaultValue: false }
should_print: DS.attr 'boolean', { defaultValue: true }
现在,类属性绑定到LineItem模型上的属性,该属性具有属性“ordered”,我已将其设置为true以进行测试,但它似乎似乎没有显示有序类,即使这样attribute设置为true。