From df5260499ee83acd14fd2fd513f5fc19cec51f11 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Sun, 11 Jan 2015 03:47:18 +0100 Subject: [PATCH] fix: bad user callback digestion Prefer using $applyAsync than $apply. Close #89 --- src/ui-ace.js | 2 +- test/ace.spec.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui-ace.js b/src/ui-ace.js index 3b19c36..7b8eb2c 100644 --- a/src/ui-ace.js +++ b/src/ui-ace.js @@ -196,7 +196,7 @@ angular.module('ui.ace', []) var args = Array.prototype.slice.call(arguments, 1); if (angular.isDefined(callback)) { - scope.$apply(function () { + scope.$applyAsync(function () { if (angular.isFunction(callback)) { callback(args); } else { diff --git a/test/ace.spec.js b/test/ace.spec.js index fbcb5e7..a6f9ec7 100644 --- a/test/ace.spec.js +++ b/test/ace.spec.js @@ -308,6 +308,7 @@ describe('uiAce', function () { scope.$apply('foo = "bar"'); $compile('
')(scope); _ace.getSession().setValue('baz'); + scope.$apply(); } expect(compileWithObject).toThrow();