Skip to content

Files

Latest commit

aaf135c · May 1, 2018

History

History
245 lines (192 loc) · 8.78 KB

api.md

File metadata and controls

245 lines (192 loc) · 8.78 KB

Members

#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.

numberInputObject

The number-input is an angular directive which provides number validation, parsing and formatting capabilities.

Functions

#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.

Events

"number-input$update-model" ([modelValue])

Event which will update the model and view value.

Typedefs

Config : Object

The directive configuration.

Interfaces

NumberInputService

Service definition used by the number input to extend the number input capabilities.

NumberInputService

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

Holds the current configuration of the service and is populated by the directive instance.

Kind: global property of NumberInputService
Access: public

NumberInputService#min : Number

Optional min value.

Kind: global property of NumberInputService
Access: public

NumberInputService#max : Number

Optional max value.

Kind: global property of NumberInputService
Access: public

NumberInputService#step : Number

Optional step value.

Kind: global property of NumberInputService
Access: public

NumberInputService#create() ⇒ Object

Returns an instance of the service used by a specific directive instance.

Kind: global method of NumberInputService
Returns: Object - The service instance
Access: public

NumberInputService#validate([modelValue], [viewValue]) ⇒ Boolean

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

NumberInputService#parse([value]) ⇒ Object

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

NumberInputService#format([value]) ⇒ Object

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

NumberInputService#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.

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

numberInput ⇒ Object

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">

"number-input$update-model" ([modelValue])

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)

Config : Object

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