[Angular] using the $ scope. $ Apply () as necessary to render mandatory front page

I. Introduction

By using AngularJS own event processing loop, changing the traditional Javascript workflow. 
This makes the implementation of Javascript is divided into portions and has a portion AngularJS original execution context.
AngularJS operation is performed only in the context of running, in order to enjoy the data binding AngularJS provided, exception handling, resource management and other features and services.
You can use the $ apply () to enter AngularJS from the general context of Javascript execution context.
Remember, in most cases the corresponding instructions (such as controller, service), $ apply have been used to deal with the current event execution before.
Only when you use a custom event callback or callback using third-party libraries, it needs its own implementation of $ apply.

Second, the callback sliding-demand authentication message, a result message is not displayed

solution:

$scope.$apply(function () {
    Tip.setMessage ( 'Please enter a new phone number ~', 'Clear', to false );
});

 

Guess you like

Origin www.cnblogs.com/websmile/p/12157295.html