Hi Martin,

A directive is not the solution. For the reasons you are giving yourself. 
If you really need to 'store' the result of the calculation back in the 
scope you are better of doing this in the controller, or even better in a 
service. If it's 'temp' data you need just for sorting or other view issues 
the controller is the best place to do it. 

If you really want to do it in the view (fully knowing this is a bad idea 
to start with) you can use an expression like this.

{{ asset.oldvalue !== undefined ? (asset.diff = asset.oldvalue - asset.
newvalue) : undefined }}

The better solution is to set the asset.diff at the same time you are 
setting the oldvalue. 

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to