Result is 33,311
But i need 333 + 11 = 344
Is possible make in template?
Thx for help
Ladislav
function Ctrl($resource){
this.items= parseInt('333');
this.next= 11;
}
2011/9/27 Ladislav Prskavec <ladislav...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>
parseInt('333', 10);
2011/9/27 Mårten Dolk <marte...@gmail.com>:
An ugly solution is like this:
{{items*1 + next*1}}
Better, if you create a new model and display that, but you need to
manually keep this new model up-to-date:
this.sum = parseInt(this.items) + parseInt(this.next)
Or you can create an add() function in your model, and use that in your view:
{{add(items, next)}}
Anyway, it is not angular issue. This is how javascript works when you
add two strings.
Andras
But I would strongly recommend against this! Better to keep this kind
of logic in the controller. Why do you want to add the numbers? Create
a function and name it appropriately and you have testable code :-)
2011/9/27 Mårten Dolk <marte...@gmail.com>: