forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.filter.currency.html
39 lines (39 loc) · 1.46 KB
/
angular.filter.currency.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<h1>angular.filter.currency</h1>
<div class="angular-filter-currency"><fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<h2>Description</h2>
<div class="description"><p>Formats a number as a currency (ie $1,234.56).</p></div>
<h2>Usage</h2>
<div class="usage"><h3>In HTML Template Binding</h3>
<div class="in-html-template-binding"><code ng:non-bindable="">{{ currency_expression | currency }}</code>
</div>
<h3>In JavaScript</h3>
<div class="in-javascript"><code ng:non-bindable="">angular.filter.currency(amount)</code>
</div>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">amount – {number} – </code>
<p>Input to filter.</p></li>
</ul>
<h3>Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
– <p>Formated number.</p></div>
</div>
<h2>Example</h2>
<div class="example"><doc:example>
<pre class="doc-source">
<input type="text" name="amount" value="1234.56"/> <br/>
{{amount | currency}}
</pre>
<pre class="doc-scenario">
it('should init with 1234.56', function(){
expect(binding('amount | currency')).toBe('$1,234.56');
});
it('should update', function(){
input('amount').enter('-1234');
expect(binding('amount | currency')).toBe('$-1,234.00');
expect(element('.doc-example-live .ng-binding').attr('className')).
toMatch(/ng-format-negative/);
});
</pre>
</doc:example></div>
</div>