简体   繁体   English

angular.js中的表达式求值

[英]Expression evaluation in angular.js

I have the following code: 我有以下代码:

<li ng-repeat="item in somearray">
    <img src="{{ item.url }}" />
</li>

For every item the browser makes a GET request that is an encoded expression, for example: " http://someurl.com/somepath/blalba/1/%7B%7Bitem.url%7D%7D ". 对于每一项,浏览器都会发出一个GET请求,该请求是一个编码表达式,例如:“ http://someurl.com/somepath/blalba/1/%7B%7Bitem.url%7D%7D ”。 Although it does load these images properly, it makes unnecessary requests. 尽管它确实正确加载了这些图像,但它发出了不必要的请求。 Is there any way to avoid this? 有什么办法可以避免这种情况?

Use: 采用:

<li ng-repeat="item in somearray">
    <img ng-src="{{item.url}}" />
</li>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM