NgSourceDirective class
In browser some attributes have network side-effect. If the attribute
has {{interpolation}}
in it it may cause browser to fetch bogus URLs.
Example: In <img src="{{username}}.png">
the browser will fetch the image
http://server/{{username}}.png
before Angular has a chance to replace the
attribute with data-bound url.
For this reason we provide ng-
prefixed attributes which avoid the issues
mentioned above as in this example: <img ng-src="{{username}}.png">
.
The full list of supported attributes are:
ng-href
ng-src
ng-srcset
@NgDirective(selector: '[ng-href]', map: const {'ng-href': '@href'}) @NgDirective(selector: '[ng-src]', map: const {'ng-src': '@src'}) @NgDirective(selector: '[ng-srcset]', map: const {'ng-srcset': '@srcset'}) class NgSourceDirective { NodeAttrs attrs; NgSourceDirective(NodeAttrs this.attrs); set href(value) => attrs['href'] = value; set src(value) => attrs['src'] = value; set srcset(value) => attrs['srcset'] = value; }