OptionValueDirective class
Since the value attirbute of the OPTION can only be a string, Angular provides
ng-value which allows binding to any expression.
@NgDirective(
selector: 'option',
publishTypes: const [TextChangeListener],
map: const {'ng-value': '&ngValue'}
)
class OptionValueDirective implements TextChangeListener, NgAttachAware, NgDetachAware {
final InputSelectDirective _inputSelectDirective;
final NodeAttrs _attrs;
Getter _ngValue;
OptionValueDirective(NodeAttrs this._attrs,
InputSelectDirective this._inputSelectDirective) {
if (_inputSelectDirective != null) {
_inputSelectDirective.expando[_attrs.element] = this;
}
}
attach() {
if (_inputSelectDirective != null) {
this._attrs.observe('value', (_) => _inputSelectDirective.dirty());
}
}
call(String text) {
if (_inputSelectDirective != null) {
_inputSelectDirective.dirty();
}
}
detach() {
if (_inputSelectDirective != null) {
_inputSelectDirective.dirty();
_inputSelectDirective.expando[_attrs.element] = null;
}
}
set ngValue(Getter value) => _ngValue = value;
get ngValue {
return _attrs['ng-value'] is String ? _ngValue() : (_attrs.element as dom.OptionElement).value;
}
}
Implements
NgDetachAware, NgAttachAware, TextChangeListener
Constructors
new OptionValueDirective(NodeAttrs _attrs, InputSelectDirective _inputSelectDirective) #
Creates a new Object instance.
Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.
docs inherited from Object
OptionValueDirective(NodeAttrs this._attrs,
InputSelectDirective this._inputSelectDirective) {
if (_inputSelectDirective != null) {
_inputSelectDirective.expando[_attrs.element] = this;
}
}
Properties
var ngValue #
get ngValue {
return _attrs['ng-value'] is String ? _ngValue() : (_attrs.element as dom.OptionElement).value;
}
set ngValue(Getter value) => _ngValue = value;
Methods
dynamic attach() #
attach() {
if (_inputSelectDirective != null) {
this._attrs.observe('value', (_) => _inputSelectDirective.dirty());
}
}
dynamic call(String text) #
call(String text) {
if (_inputSelectDirective != null) {
_inputSelectDirective.dirty();
}
}
dynamic detach() #
detach() {
if (_inputSelectDirective != null) {
_inputSelectDirective.dirty();
_inputSelectDirective.expando[_attrs.element] = null;
}
}