NG-SRC的角度JS [英] ng-src in angular js
问题描述
我们可以用图片src与的src
和 NG-SRC
在角JS
We can use image src with src
and ng-src
in angular js
<img src="theme/image.png" alt="Image"/>
和
<img ng-src="theme/image.png" alt="Image"/>
我不觉得他们之间的差异显示image.is有什么区别吗?我有意见的项目是从外部站点加载,我是否需要改变每的src
到 NG-SRC
?不会创建任何性能问题,当我尝试加载大量的图片?
I do not feel any difference between them in showing image.is there any difference? I have a project with views are loading from an external site,do i need to change every src
to ng-src
?does it create any performance issue when i try to load large number of images?
推荐答案
让我报价
采用了棱角分明的标记像{{哈希}}在src属性不工作的权利:浏览器将与文字文本网址提取{{哈希}},直到角替换里面的前pression {{哈希}}。所述ngSrc指令解决了这个问题。
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.
了解更多:<一href=\"https://docs.angularjs.org/api/ng/directive/ngSrc\">https://docs.angularjs.org/api/ng/directive/ngSrc
这篇关于NG-SRC的角度JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!