Dart Documentationangular.core.domNgAttrMustacheDirective

NgAttrMustacheDirective class

@NgDirective(selector: r'[*=/{{.*}}/]')
class NgAttrMustacheDirective {
 static RegExp ATTR_NAME_VALUE_REGEXP = new RegExp(r'^([^=]+)=(.*)$');

// This Directive is special and does not go through injection.
 NgAttrMustacheDirective(NodeAttrs attrs, String markup, Interpolate interpolate, Scope scope) {
   var match = ATTR_NAME_VALUE_REGEXP.firstMatch(markup);
   var attrName = match[1];
   Expression interpolateFn = interpolate(match[2]);
   Function attrSetter = (text) => attrs[attrName] = text;
   attrSetter('');
   scope.$watch(interpolateFn.eval, attrSetter, markup.trim());
 }
}

Static Properties

RegExp ATTR_NAME_VALUE_REGEXP #

static RegExp ATTR_NAME_VALUE_REGEXP = new RegExp(r'^([^=]+)=(.*)$')

Constructors

new NgAttrMustacheDirective(NodeAttrs attrs, String markup, Interpolate interpolate, Scope scope) #

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
NgAttrMustacheDirective(NodeAttrs attrs, String markup, Interpolate interpolate, Scope scope) {
 var match = ATTR_NAME_VALUE_REGEXP.firstMatch(markup);
 var attrName = match[1];
 Expression interpolateFn = interpolate(match[2]);
 Function attrSetter = (text) => attrs[attrName] = text;
 attrSetter('');
 scope.$watch(interpolateFn.eval, attrSetter, markup.trim());
}