我想用来自
JSON对象的src实现img.
在AngularJS中,我可以这样做:
<img ng-src="{{hash}}" alt="Description" />
在Angular 2中有没有相同的东西?
AngularJS:
原文链接:https://www.f2er.com/angularjs/142418.html<img ng-src="{{movie.imageurl}}">
角度2:
<img [src]="movie.imageurl">
请注意,插值可以实现相同的结果:
<img src="{{vehicle.imageUrl}}"> <img [src]="vehicle.imageUrl">
这两个属性绑定语句之间没有技术差异,只要您不希望双向绑定.
Interpolation is a convenient alternative for property binding in many cases. In fact,Angular translates those interpolations into the corresponding property bindings before rendering the view. 07001