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

后端 未结 9 1351
独厮守ぢ
独厮守ぢ 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:34

    The most obvious difference between them is Flash of Unstyled content while using {{ ... }}.

    However, there is a more subtle difference between the two if the object you pass to {{ obj }} and ng-bind="obj" is not a string.

    From https://stackoverflow.com/a/19744728/987185 :

    Depending on whether you use {{ ... }} or ng-bind syntax, the .toJSON and the .toString function on your object will be called to determine its representation.

提交回复
热议问题