gpt4 book ai didi

javascript - angular js中的ng-src

转载 作者:行者123 更新时间:2023-12-02 06:56:05 26 4
gpt4 key购买 nike

我们可以在 Angular js 中使用带有 srcng-src 的图像 src

 <img src="theme/image.png" alt="Image"/>

<img ng-src="theme/image.png" alt="Image"/> 

我觉得他们在显示图像上没有什么区别。有什么区别吗?我有一个项目,其中的 View 是从外部站点加载的,我是否需要将每个 src 更改为 ng-src?当我尝试加载时它会产生任何性能问题吗大量图像?

最佳答案

让我引用

Using Angular markup like {{hash}} in a src attribute doesn't work right: The browser will fetch from the URL with the literal text {{hash}} until Angular replaces the expression inside {{hash}}. The ngSrc directive solves this problem.

阅读更多:https://docs.angularjs.org/api/ng/directive/ngSrc

关于javascript - angular js中的ng-src,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31161739/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com