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

相關文章
相關標籤/搜索