Difference between ng-bind and interpolation {{}} in Angular

后端 未结 9 1369
独厮守ぢ
独厮守ぢ 2020-12-03 02:05

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

I am quite new to Angular. I started with using {{ }} and then in the documentation i find ng-bind. I

9条回答
  •  盖世英雄少女心
    2020-12-03 02:21

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

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

    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.

提交回复
热议问题