<input
type="number"
name="myDecimal"
placeholder="Decimal"
ng-model="myDecimal"
*step="0.01"
*
/>
<input
type="number"
name="myDecimal"
placeholder="Decimal"
ng-model="myDecimal"
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
step="0.01"
/>
<input
type="number"
name="myDecimal"
placeholder="Decimal"
ng-model="myDecimal"
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
step="0.01"
/>
<span>Is a valid decimal? </span>
A full example using bootstrap (demo here):
<div ng-app>
<h2>Todo</h2>
<div ng-controller="myCtrl">
<form name="myForm" class="form-horizontal">
<div
class="form-group"
ng-class="{'has-error': myForm.myDecimal.$invalid}"
>
<label for="inputText3" class="col-sm-2 control-label">Decimal</label>
<div class="col-sm-10">
<input
type="number"
class="form-control"
name="myDecimal"
placeholder="Decimal"
ng-model="myDecimal"
ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/"
step="0.01"
required
/>
<span class="help-block" ng-show="!myForm.myDecimal.$valid">
Invalid!
</span>
</div>
</div>
<div class="form-group">
<label for="inputText3" class="col-sm-2 control-label"
>The value:</label
>
<div class="col-sm-10">
<input
type="text"
class="form-control"
ng-model="myDecimal"
disabled
/>
</div>
</div>
</form>
</div>
</div>
Hope this helps.