更新时间:2023-12-01 18:25:52
Angular2 中的表达式在允许的范围方面与 Angular 中的表达式非常相似.
Expressions in Angular2 are very similar to expressions in Angular in terms of the scope of what they allow.
禁止促进副作用的 JavaScript 表达式,包括
JavaScript expressions that promote side effects are prohibited including
new
关键字此外,不支持像 |
或 &
Furthermore, there is no support for bitwise operators like |
or &
通常,***将复杂的 JavaScript 逻辑放在控制器或组件中,而不是放在视图中.这是因为关注点分离
的设计原则,使代码更加模块化和可读.
Generally, it's a good idea to put complex JavaScript logic inside a controller or component, instead of inside a view. This is because of the Separation of Concerns
design principle and making code more modular and readable.
https://angular.io/docs/ts/latest/guide/template-syntax.html#!#template-expressions