来自文档:
Embedding interpolation markup inside expressions
Note: AngularJS directive attributes take either expressions or interpolation markup with embedded expressions. It is considered bad practice to embed interpolation markup inside an expression:
—AngularJS Developer Guide - Interpolation
block 引用>我正在寻找一个写得好的规范答案,我可以向读者指出。
最佳答案
来自文档:
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 - 为什么混合插值和表达式是不好的做法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51592045/