在角NG绑定和内插{{}}之间的区别 [英] Difference between ng-bind and interpolation {{}} in Angular

查看:142
本文介绍了在角NG绑定和内插{{}}之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何区别
{{}}和角度NG-绑定。

Is there any difference between {{ }} and ng-bind in angular.

我很新的角度。我开始使用{{}},然后在文档中我发现NG-绑定。我认为他们做同样的工作,但为什么一个额外的指令,如果不是,那么请告诉区别。

I am quite new to Angular. I started with using {{ }} and then in the documentation i find ng-bind. I think they do the same work but then why an extra directive, if not then please tell the difference.

推荐答案

有是在官方文档的一些提示:<一href=\"https://docs.angularjs.org/api/ng/directive/ngBind\">https://docs.angularjs.org/api/ng/directive/ngBind

There is some hint in the official docs: https://docs.angularjs.org/api/ng/directive/ngBind

通常情况下,你不直接使用ngBind,而是你用
  双大标记像{{前pression}}这是类似但不
  详细。

Typically, you don't use ngBind directly, but instead you use the double curly markup like {{ expression }} which is similar but less verbose.

这是preferable使用ngBind代替{{EX pression}}如果
  模板暂时由浏览器在其原始状态下显示
  前角编译它。由于ngBind是一个元素属性,它
  使得当页面加载绑定用户看不到的。

It is preferable to use ngBind instead of {{ expression }} if a template is momentarily displayed by the browser in its raw state before Angular compiles it. Since ngBind is an element attribute, it makes the bindings invisible to the user while the page is loading.

这篇关于在角NG绑定和内插{{}}之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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