If I have a template in the form of:
<div ng-controller="testCtrl">
<div ng-if="exFn()"></div>
<div ng-if="exFn()"></div>
</div>
will the ngController scope call exFn
twice per $digest, or will the scope remember that the exFn()
expression's new value and use it instead of reevaluating the expression?
It will call exFn
four times. Twice to find out the original value for each watch, then twice again to see if they are stable. This makes sense: the function could depend on external state.
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.