简体   繁体   中英

What is the syntax of angular one time binding for multiple properties in ng-if

I have an

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

What i want to do is to have one time bindings for both variables in ng-if . But when i try to use

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

angular throws the following error :

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)].

What is the right way ?

尝试这种方式:

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

this should works fine:

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

You don't need double colon twice

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM