angularjs - ng-if 中多个属性的 Angular 一次性绑定(bind)的语法是什么

标签 angularjs angular-ng-if one-time-binding

我有一个

ng-if="dc.emailNotificationSchedule.progressInterval === dc.SkillCompletionProgressIntervals.NEVER_LOGGED_IN"

我想要做的是对 ng-if 中的两个变量进行一次绑定(bind)。但是当我尝试使用

ng-if="(::dc.emailNotificationSchedule.progressInterval) === (::dc.SkillCompletionProgressIntervals.NEVER_LOGGED_IN)"

Angular 抛出以下错误:

Error: [$parse:syntax] Syntax Error: Token ':' not a primary expression at column 2 of the expression [(::dc.emailNotificationSchedule.progressInterval) === (::dc.SkillCompletionProgressIntervals.NEVER_LOGGED_IN)] starting at
[::dc.emailNotificationSchedule.progressInterval) ===
(::dc.SkillCompletionProgressIntervals.NEVER_LOGGED_IN)].

什么是正确的方法?

最佳答案

试试这个方法:

ng-if="::(dc.emailNotificationSchedule.progressInterval === dc.SkillCompletionProgressIntervals.NEVER_LOGGED_IN)"

关于angularjs - ng-if 中多个属性的 Angular 一次性绑定(bind)的语法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35430762/

相关文章:

javascript - 避免 ng-repeat 仍然使用双向绑定(bind)

javascript - AngularJs 使用 bool 运算符一次性绑定(bind)和值的顺序

javascript - 在 ng Repeat 中传递变量时出现 Angular youtube-embed 错误

javascript - 按出现次数对数组进行分组并使用 Lodash 对其进行排序

javascript - 使用 Angular 和 Angular-Route 扩展动态标题

javascript - Angular 表达式执行顺序(带 ngif 的分层 div)似乎未按预期工作

javascript - AngularJS:如何显示数组的数组?

angular - *ngIf 中字符串动态变量的变量字段名称/属性名称

angularjs - 有条件地在 Angular App 中包含侧边栏和标题

javascript - Angular 一次性有条件绑定(bind)或在设置特定值时取消绑定(bind)监听器