Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 491369a

Browse files
rebornixdouglasduteil
authored andcommitted
fix: ngModel update
Closes #77
1 parent b0f02ce commit 491369a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/ui-ace.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,10 @@ angular.module('ui.ace', [])
218218
onChange: function (callback) {
219219
return function (e) {
220220
var newValue = session.getValue();
221-
if (newValue !== scope.$eval(attrs.value) && !scope.$$phase && !scope.$root.$$phase) {
222-
if (ngModel !== null) {
223-
scope.$apply(function () {
224-
ngModel.$setViewValue(newValue);
225-
});
221+
if (newValue !== scope.$eval(attrs.value)) {
222+
if (angular.isDefined(ngModel)) {
223+
ngModel.$setViewValue(newValue);
224+
!scope.$$phase && !scope.$root.$$phase && scope.$digest();
226225
}
227226
executeUserCallback(callback, e, acee);
228227
}

0 commit comments

Comments
 (0)