- #config :
Config
Holds the current configuration of the service and is populated by the directive instance.
- #min :
Number
Optional min value.
- #max :
Number
Optional max value.
- #step :
Number
Optional step value.
- numberInput ⇒
Object
The number-input is an angular directive which provides number validation, parsing and formatting capabilities.
- #create() ⇒
Object
Returns an instance of the service used by a specific directive instance.
- #validate([modelValue], [viewValue]) ⇒
Boolean
Optional validation function.
This function is optional and it is not required to implement it.- #parse([value]) ⇒
Object
Optional parser function.
This function is optional and it is not required to implement it.- #format([value]) ⇒
Object
Optional formatter function.
This function is optional and it is not required to implement it.- #link(scope, element, attributes, ngModelCtrl)
Will be called only once when the directive has access to the service.
This function is optional and it is not required to implement it.
- "number-input$update-model" ([modelValue])
Event which will update the model and view value.
- Config :
Object
The directive configuration.
- NumberInputService
Service definition used by the number input to extend the number input capabilities.
Service definition used by the number input to extend the number input capabilities.
Kind: global interface
Access: public
Author: Sagie Gur-Ari
- NumberInputService
- #config :
Config
- #min :
Number
- #max :
Number
- #step :
Number
- #create() ⇒
Object
- #validate([modelValue], [viewValue]) ⇒
Boolean
- #parse([value]) ⇒
Object
- #format([value]) ⇒
Object
- #link(scope, element, attributes, ngModelCtrl)
- #config :
NumberInputService#config : Config
Holds the current configuration of the service and is populated by the directive instance.
Kind: global property of NumberInputService
Access: public
Optional min value.
Kind: global property of NumberInputService
Access: public
Optional max value.
Kind: global property of NumberInputService
Access: public
Optional step value.
Kind: global property of NumberInputService
Access: public
Returns an instance of the service used by a specific directive instance.
Kind: global method of NumberInputService
Returns: Object
- The service instance
Access: public
Optional validation function.
This function is optional and it is not required to implement it.
Kind: global method of NumberInputService
Returns: Boolean
- true if valid
Access: public
Param | Type | Description |
---|---|---|
[modelValue] | Object |
The model value |
[viewValue] | Object |
The UI view value |
Optional parser function.
This function is optional and it is not required to implement it.
Kind: global method of NumberInputService
Returns: Object
- The parsed value
Access: public
Param | Type | Description |
---|---|---|
[value] | Object |
The value to parse |
Optional formatter function.
This function is optional and it is not required to implement it.
Kind: global method of NumberInputService
Returns: Object
- The formatted value
Access: public
Param | Type | Description |
---|---|---|
[value] | Object |
The value to format |
Will be called only once when the directive has access to the service.
This function is optional and it is not required to implement it.
Kind: global method of NumberInputService
Access: public
Param | Type | Description |
---|---|---|
scope | Object |
The angular scope for the element |
element | Object |
The jquery element on which the directive is defined on |
attributes | Object |
Provides access to the element attributes |
ngModelCtrl | Object |
The angular model controller |
The number-input is an angular directive which provides number validation, parsing and formatting capabilities.
Kind: global variable
Returns: Object
- The directive definition
Ngdoc: directive
Restrict: ECA
Param | Type | Description |
---|---|---|
ng-model | Number |
The model for the number input |
[min] | Number |
Optional min number value |
[max] | Number |
Optional max number value |
[step] | Number |
Optional step between numbers |
[validation] | function |
Optional external validation function |
[parser] | function |
Optional external parser function |
[formatter] | function |
Optional external formatter function |
[service] | String |
Optional service to inject which will be used to control the directive behaviour (will override validation, parser and formatter attributes) |
Example
<!-- simple usage of the directive with custom validation/formatting/parsing -->
<input type="text" class="number-input"
ng-model="value"
min="-100"
max="100"
step="0.5"
validation="myNumberValidation"
formatter="myNumberFormatter"
parser="myNumberParser">
<!-- using angular service for common custom validation/formatting/parsing -->
<input type="text" class="number-input"
ng-model="value"
service="myService">
Event which will update the model and view value.
Kind: event emitted
Param | Type | Description |
---|---|---|
[modelValue] | Object |
The new model value (undefined to use the ngModelCtrl.$modelValue instead) |
The directive configuration.
Kind: global typedef
Param | Type | Description |
---|---|---|
[min] | Number |
Optional min number value |
[max] | Number |
Optional max number value |
[step] | Number |
Optional step between numbers |