Controllers for Ember View editable

I am building an Ember app which makes calculations

I have posted a question in Stakeoverflow but I have got any answer, the only thing recommended it was to set the computed properties although I was not really sure about this solution.

The problem is that I don’t know how to implement one of my controllers which makes a moltiplication between two values on a Ember view editable.

Here the controller function:

  total: function(){

     return this.get('newThread.primary') * this.get('newThread.selectContentTariffa');
     }.property('newThread.primary', 'newThread.selectContentTariffa'),

In my view this is where i display the result of the moltiplication:

 `{{#view "totale"}}{{total}}{{/view}}`

For instance if my value are the same i have in my editable view (item.primary, item.seleectContentTariffa), it does not make any calculation.

In the view not editable it works as it should

What s the way to achieve that? I have maybe need to put some condions i am in editable view? i am very new in ember and i still dont have these basic concepts

The jsbin in action to reproduce the case:

I am also new in Ember, and as a way of learning Ember, I have been reading threads to see if I could find a problem I could fix or help out on. So, I’m not sure what you’re trying to do. Are you trying to display the column 3 after you add an item/thread?

Just playing around with your code in an Ember jsbin I found that if you delete this line (see below) that column 3 shows when you return to “edit” mode but it breaks some of your other functionality.


Also it seems you have an extra < /td> at the end of your table.

Thanks for your answer @Ramcat , but this is not my code and i am talking about a completely different issue

@Ramcat, I was reviewing your code, and actually you are right, it started working but i need the add function obviously, sorry for my previous answer and for not reading properly

Hey no problem. I don’t know if this would help but here is a jsbin where I am adding “genes” to an array. To use it, click “Collection”, then on the right side create and add genes. The method on the CollectionController that “adds” the gene is “createGene”. I think your code is better than most of the code in this example but it might help you think about the problem differently.