NG-SRC的角度JS [英] ng-src in angular js

查看:103
本文介绍了NG-SRC的角度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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆