Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://cdn.static.w3big.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body ng-app=""> <div ng-init="myVar = '../wp-content/uploads/2014/06/angular.jpg'"> <h1>Angular</h1> <img ng-src="{{myVar}}"> </div> <p>该实例可以使用原生的 src 输出,但是使用 AngularJS 代码插入值,使用 ng-src 属性更好。</p> </body> </html>