AngularJS ng-srcset Instruction
AngularJS Examples
Define the resource address of an image:
<
div
ng-init=
"myVar = 'http://www.runoob.com/wp-content/uploads/2014/06/angular.jpg'"
<
h1
Angular
<
/h1
<
img
ng-srcset=
"{{myVar}}"
<
/div
Try it »
Definition and Usage
ng-srcset The directive overrides the element's srcset attribute.
If you use AngularJS code to set the image address, please use ng-srcset directive instead of srcset attribute.
ng-srcset The directive ensures the image is not displayed before the AngularJS code executes.
Syntax
<
img
ng-srcset=
"string"
<
/img
and
Parameter value
| Value | Description |
|---|---|
| string | A string returned by the expression. |
AngularJS Reference Manual