什么相当于较新的Angular中的ngSrc?

前端之家收集整理的这篇文章主要介绍了什么相当于较新的Angular中的ngSrc?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想用来自 JSON对象的src实现img. @H_403_1@在AngularJS中,我可以这样做:

<img ng-src="{{hash}}" alt="Description" />
@H_403_1@在Angular 2中有没有相同的东西?

@H_404_7@
@H_404_7@
AngularJS:
<img ng-src="{{movie.imageurl}}">
@H_403_1@角度2:

<img [src]="movie.imageurl">
@H_403_1@Angular docs

@H_403_1@请注意,插值可以实现相同的结果:

<img src="{{vehicle.imageUrl}}">

<img [src]="vehicle.imageUrl">
@H_403_1@这两个属性绑定语句之间没有技术差异,只要您不希望双向绑定.

@H_403_1@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

@H_404_7@

猜你在找的Angularjs相关文章