luid-percentage

An input that display and edit a percentage in a user friendly manner but has a model value more easily usable by the js code and support different formats.

Features

It is editable using a regex as pattern recognition to know if the inputed text is parsable into some kind of float. If the pattern is invalid the binded value will be set to undefined. This allows the luid-percentage to be compatible with required and ng-required.

Upon pressing enter or losing focus of the input, it will format the input into a more readable form. For example you enter 10.00 and press enter, the text will change to 10

Supports up and down key events and scroll event to increment/decrement the value.

Supports 3 formats :

Supported arguments

Usage:

<luid-percentage ng-model="myValue"></luid-percentage>
<luid-percentage ng-model="myValue" format="XX" step=25></luid-percentage>

myValue in luid-percentage :

myValue as it is in $scope :

Number of time ng-change on the luid-timespan has been called : {{updateCnt}}


myPrice : $ increased by myCoeff :

{{ myCoeff * myPrice | currency }} = {{ myCoeff * myPrice | currency}}, made using format="1.XX"