AngularJS ng-srcset directive
definition and usage
ng-srcset
directive will override the original srcset
attribute.
If the srcset value contains AngularJS code, then it should use ng-srcset
directive replaces srcset
.
ng-srcset
The directive ensures that the image will not be displayed incorrectly before the AngularJS code is evaluated.
Example
Add an image where srcset is calculated by AngularJS:
<div ng-init="myVar = 'pic_angular.jpg'"> <h1>Angular</h1> <img ng-srcset="{{myVar}}"> </div>
Syntax
<img ng-srcset="string</img>
is affected by <img>
and <source>
Element Support.
Parameter
Parameter | Description |
---|---|
string | String value, or expression result is a string. |