Why mixing interpolation and expressions is bad practice

后端 未结 2 589
無奈伤痛
無奈伤痛 2020-11-22 05:38

From the Docs:

Embedding interpolation markup inside expressions

Note: AngularJS directive attributes take either

2条回答
  •  春和景丽
    2020-11-22 06:12

    From the Docs:

    Why mixing interpolation and expressions is bad practice:

    • It increases the complexity of the markup

    • There is no guarantee that it works for every directive, because interpolation itself is a directive. If another directive accesses attribute data before interpolation has run, it will get the raw interpolation markup and not data.

    • It impacts performance, as interpolation adds another watcher to the scope.

    AngularJS Developer Guide - Interpolation

提交回复
热议问题