I have an input that uses ng-pattern like so:
<input type="text" min="0" ng-pattern="/^[0-9]+(\.[0-9]{2})?$/" ng-model="payment.amount" />
However, if I try and change my payment.amount in scope, like so:
$scope.payment.amount = 150.5;
It fails to bind. Note the regex - if the amount has a decimal place, it must include two digits after it. If it doesn't, it fails validation.
See obligatory plunker: http://plnkr.co/edit/TIltn1NEHdN3so6GnTQi?p=preview
The Question: how can I get it to bind correctly, preferably with a 0 at the end of the number?