itemController和bindAttr无法正常工作

时间:2013-05-08 14:57:51

标签: ember.js emblem.js

我在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 &nbsp 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。

0 个答案:

没有答案
相关问题