AngularJS : Why ng-bind is better than {{}} in angular?

前端 未结 12 706
灰色年华
灰色年华 2020-11-22 07:19

I was in one of the angular presentation and one of the person in the meeting mentioned ng-bind is better than {{}} binding.

One of the re

12条回答
  •  悲&欢浪女
    2020-11-22 07:46

    ng-bind is better than {{...}}

    For example, you could do:

    Hello, {{variable}}

    This means that the whole text Hello, {{variable}} enclosed by

    will be copied and stored in memory.

    If instead you do something like this:

    Hello,

    Only the value of the value will be stored in memory, and angular will register a watcher (watch expression) which consists of the variable only.

提交回复
热议问题