MaterialNumberValueAccessor class

ControlValueAccessor which will coerce an input into a num.

Use materialNumberInputDirectives to get a set of directives to use with the input to provide validations. Such as the default to ensure it is a number, checkInteger, checkPositive, checkNonNegative (allows 0,) lowerBound, and upperBound.

keypressUpdate attribute has the value update on every keypress while the default is the value only updating on a blur event. blurFormat attribute causes the input to be formatted on blur events.

Inheritance
Annotations
  • @Directive(selector: 'material-input[type=number],material-input[type=percent]')

Constructors

MaterialNumberValueAccessor(BaseMaterialInput input, @Self() NgControl control, @Attribute('changeUpdate') String? changeUpdateAttr, @Attribute('keypressUpdate') String? keypressUpdateAttr, @Attribute('checkInteger') String? checkInteger, @Attribute('blurFormat') String? blurFormat, @Optional() NumberFormat? numberFormat)

Properties

disposer Disposer
finalinherited
hashCode int
The hash code for this object.
no setterinherited
input BaseMaterialInput
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

formatValue(num? value) String
Formats a value using provided NumberFormat, falling back to MaterialInputDefaultValueAccessor formatValue if none provided.
inherited
ngOnDestroy() → void
Executed before the directive is removed from the DOM and destroyed.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDisabledChanged(bool isDisabled) → void
This function is called when the control status changes to or from "DISABLED".
inherited
parseNumber(String? input) num?
Coerces the String value of the MaterialInput into type of T.
override
registerOnChange(ChangeFunction<num?> callback) → void
Set the function to be called when the control receives a change event.
inherited
registerOnTouched(TouchFunction callback) → void
Set the function to be called when the control is touched.
inherited
toString() String
A string representation of this object.
inherited
writeValue(num? newValue) → void
Write a new value to the element.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited