mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 07:50:22 +00:00
20 lines
493 B
Markdown
20 lines
493 B
Markdown
|
|
# filter:currency
|
||
|
|
formats a number as a currency (ie $1,234.56)
|
||
|
|
|
||
|
|
@format _expression_ | currency
|
||
|
|
|
||
|
|
<example>
|
||
|
|
<input type="text" name="amount" value="1234.56"/> <br/>
|
||
|
|
{{amount | currency}}
|
||
|
|
</example>
|
||
|
|
|
||
|
|
<test>
|
||
|
|
it('should init with 1234.56', function(){
|
||
|
|
expect(bind('amount')).toEqual('$1,234.56');
|
||
|
|
});
|
||
|
|
it('should update', function(){
|
||
|
|
element(':input[name=amount]').value('-1234');
|
||
|
|
expect(bind('amount')).toEqual('-$1,234.00');
|
||
|
|
expect(bind('amount')).toHaveColor('red');
|
||
|
|
});
|
||
|
|
</test>
|