标签:
Install with Bower:
$ bower install angular-percentage-filter
Include the library:
<script src="/bower_components/angular-percentage-directive/percentage.js"></script>
Import it to the angular applicaiton:
angular.module(‘myApp‘, [‘percentage‘]);
Use it in the view:
<span>{{ 2/3 | percentage:2:"$" }}</span> <span>{{ 0.2 | percentage }}</span> <span>{{ (items | filter:{done: true}).length/items.length | percentage }}</span>
可以自定义小数位及百分号格式,比如
2/3 | percentage:2:"$" ---> 33.33$
标签:
原文地址:http://my.oschina.net/u/2351685/blog/522026