AngularJS ng-srcset directive
AngularJS instance
Define the resource address of the image:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="/libs//1.4.6/"></script> </head> <body ng-app=""> <div ng-init="myVar = '/wp-content/uploads/2014/06/'"> <h1>Angular</h1> <img ng-srcset="{{myVar}}"> </div> <p>This instance can use native srcset Output,But use AngularJS Code insert value,use ng-srcset Better attributes。</p> </body> </html>
Definition and usage
ng-srcset The directive overrides the srcset property of the <img> element.
If you use AngularJS code to set the image address, use the ng-srcset directive instead of the srcset property.
ng-srcset The command ensures that the AngularJS code does not display images before execution.
grammar
<img ng-srcset="string"></img>
The <img> and <source> elements support this property.
Parameter value
value | describe |
---|---|
string | The string returned by the expression. |
The above is the basic information of the ng-srcset instruction. We will continue to organize it later. Thank you for your support for this website!