Search code examples
angularjsformatcurrency

Applying a filter with ng-model realtime Angular


I have a input tag like this

 <input currency  type="text" class="form-control amount" ng-model="loan.total">

what I want to do is I want to view this "total" value as separated 3 by 3(4000 -> 4 000).loan.total value should be 4000. but it should be visible as 4 000. tried to apply a directive but didn't work.

is there any easy way to do this?


Solution

  • You can display a value as currency outside the input like this:

    <input  type="number" class="form-control amount" ng-model="loan.total"> {{loan.total | currency}}