vignesh selvarathinam vignesh selvarathinam - 24 days ago 7
AngularJS Question

AngularJs Filter : how to bind two values in one span,where one value is using filter?

I am new to angularJS.

I want an output like this using angularJs Filter

My first expression: 456 $5.00

If i didn't use the filter then,{{}} displays correctly,but if use filter the output shows as below:

{{ 456+ " " + 56 | currency}}


My code:

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>

<div ng-app>
<p>My first expression: {{ 456 + " " + 5 | currency}}</p>
</div>

</body>
</html>


Any suggestions please.

Answer

Use parentheses: {{ 456 + " " + (5 | currency) }}.

Or just move 456 out of the expression: 456 {{ 5 | currency }}.

Comments