所以我一直在阅读官方文档《Angular2的模板语法》angular.io在属性绑定(bind)“避免副作用”的子标题中,我看到这些我不理解的行
We can’t assign a value to anything in a property binding expression nor use the increment and decrement operators. our expression might invoke a property or method that has side effects. Angular has no way of knowing that or stopping us.
最佳答案
不支持在属性绑定(bind)表达式中将 'yyy'
分配给 xxx
<div [someProp]="xxx = 'yyy'"> <!-- doesn't work -->
不支持使用递增和递减运算符
<div [someProp]="xxx++"> <!-- doesn't work -->
关于javascript - Angular 2 : property binding and side effects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38670736/