$rootScope.Scope.$evalAsync()

$evalAsync([expression], [locals]);

Executes the expression on the current scope at a later point in time.

The $evalAsync makes no guarantees as to when the expression will be executed, only that:

  • it will execute after the function that scheduled the evaluation (preferably before DOM rendering).
  • at least one $digest cycle will be performed after expression execution.

Any exceptions from the execution of the expression are forwarded to the $exceptionHandler service.

Note: if this function is called outside of a $digest cycle, a new $digest cycle will be scheduled. However, it is encouraged to always call code that changes the model from within an $apply call. That includes code evaluated via $evalAsync.

Parameters

Param Type Details
expression
(optional)
stringfunction()

An angular expression to be executed.

  • string: execute using the rules as defined in expression.
  • function(scope): execute the function with the current scope parameter.
locals
(optional)
object

Local variables object, useful for overriding values in scope.

doc_AngularJS
2016-03-29 16:10:39
Comments
Leave a Comment

Please login to continue.