From e6df398e98a85cbdaa60813ef1b7bf01e04aef82 Mon Sep 17 00:00:00 2001 From: Danilo Velasquez Urrutia Date: Tue, 19 Jul 2016 09:12:52 -0400 Subject: [PATCH] Adding $evalAsync suggestion In the controller is better use $evalAsync than $timeout to queue in the digest cycle for tasks like this. http://stackoverflow.com/questions/17301572/angularjs-evalasync-vs-timeout --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 02c1d51..e18ca57 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,17 @@ $timeout(function(){ }); ``` +or better using `$scope.$evalAsync` as: + +```javascript +$scope.$storage.school = theSchool; +$log.debug("launching and saving the new value" + url); +$scope.$evalAsync(function(){ + var myWindow = $window.open("", "_self"); + myWindow.document.write(response.data); +}); +``` + And your new values will be persisted correctly. Todos