简体   繁体   中英

is mixing one time with one way binding in Angualrjs possible inside ng-if?

I'm using latest AngluarJS release, I was wondering if I can combine one time with one way binding in one expression inside ng-if directive , some like that:

ng-if="(vm.isUnix) && (::vm.isGnsEnabled)"

The line above throws an error, not working

This is not possible. The one time binding token must come first and will mean that once the expression is stable it will no longer be watched.

ng-if="::vm.isUnix && vm.isGnsEnabled"

If vm.isUnix can change during the lifetime of your component and you need to reflect this change in the view, there is no way to prevent a watcher for this expression.

Edit: basically one-time binding is for the entire expression, not for individual properties inside the expression.

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