Angular引入百分比过滤器

Installation

Install with Bower:css

$ bower install angular-percentage-filter

Usage

Include the library:git

<script src="/bower_components/angular-percentage-directive/percentage.js"></script>

Import it to the angular applicaiton:github

angular.module('myApp', ['percentage']);

Use it in the view:web

<span>{{ 2/3 | percentage:2:"$" }}</span>
<span>{{ 0.2 | percentage }}</span>
<span>{{ (items | filter:{done: true}).length/items.length | percentage }}</span>


能够自定义小数位及百分号格式,好比app

2/3 | percentage:2:"$"   --->   33.33$ssh

相关文章
相关标签/搜索