AngularJs Filter:如何在一个span中绑定两个值,其中一个值使用filter?

时间:2016-11-11 07:46:51

标签: angularjs angularjs-filter

我是angularJS的新手。

我想使用angularJs Filter

这样的输出

我的第一个表达:456 $ 5.00

如果我没有使用过滤器,则{{}}会正确显示,但如果使用过滤器,则输出显示如下:

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

我的代码:

<!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>

请提出任何建议。

1 个答案:

答案 0 :(得分:3)

使用括号:{{ 456 + " " + (5 | currency) }}

或者只是将456移出表达式:456 {{ 5 | currency }}