AngularJS ng-src directive
AngularJS instance
Add image address:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app=""><div ng-init="myVar = 'http://www.runoob.com/wp-content/uploads/2014/06/angular.jpg'"><h1>Angular</h1><img ng-src="{{myVar}}"></div><p>This instance can use native src Output, but using AngularJS code to insert values, using the ng-src attribute is better. </p></body></html>Definition and usage
The ng-src directive overrides the src attribute of the <img> element.
If you use AngularJS code to set the image address, use the ng-src directive instead of the src attribute.
The ng-src directive ensures that the AngularJS code does not display images before execution.
grammar
<img ng-src="string"></img>
The <img> element supports this property.
Parameter value
| value | describe |
|---|---|
| string | The string returned by the expression. |
The above is to organize the AngularJS ng-src information and continue to add it in the future. Thank you for your support for this site!