1

I want my ember view displaying the result of the total calculation in an input in order to get the value binding of the result.

Everything works fine a part from that i can not get the result inside my Input number

This is my view

App.TotalView = Ember.View.extend({
 tagName: 'input',
 templateName:"total",
 attributeBindings: ['value', 'placeholder'],
 placeholder: null,
 value: '',
 total: (function() {
    var res= parseInt(this.get('controller.newThread.selectContentTariffa')) * parseInt(this.get('controller.newThread.primary'));
   return isNaN(res)?"":res;
    }).property('controller.newThread.selectContentTariffa', 'controller.newThread.primary')
});

This is my html

  <script type="text/x-handlebars" data-template-name="total">
    {{view.total}}
  </script>

Why the result is displayed out of the input?

I have reproduced the issue here: http://emberjs.jsbin.com/piqihi/edit?html,js

>

4

1 回答 1

1

好的,检查这个jsbin,你的视图中有这个值:'',然后总计:(计算)只需替换值:(你的计算)没有总计属性。

于 2014-10-23T17:30:01.457 回答