This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,10 @@ angular.module('ui.ace', [])
272
272
ngModel . $render = function ( ) {
273
273
session . setValue ( ngModel . $viewValue ) ;
274
274
} ;
275
+
276
+ acee . on ( 'change' , function ( event ) {
277
+ ngModel . $setViewValue ( acee . getValue ( ) ) ;
278
+ } ) ;
275
279
}
276
280
277
281
// Listen for option updates
Original file line number Diff line number Diff line change @@ -284,6 +284,24 @@ describe('uiAce', function () {
284
284
//
285
285
expect ( scope . foo ) . toBe ( 'baz' ) ;
286
286
} ) ;
287
+
288
+ it ( 'should update the model if text inserted programmatically' , function ( ) {
289
+ $compile ( '<div ui-ace ng-model="foo">' ) ( scope ) ;
290
+ scope . $apply ( 'foo = "bar"' ) ;
291
+
292
+ _ace . insert ( 'baz ' ) ;
293
+
294
+ expect ( scope . foo ) . toBe ( 'baz bar' ) ;
295
+ } ) ;
296
+
297
+ it ( 'should update the model if text removed programmatically' , function ( ) {
298
+ $compile ( '<div ui-ace ng-model="foo">' ) ( scope ) ;
299
+ scope . $apply ( 'foo = "baz bar"' ) ;
300
+
301
+ _ace . removeWordRight ( ) ;
302
+
303
+ expect ( scope . foo ) . toBe ( ' bar' ) ;
304
+ } ) ;
287
305
} ) ;
288
306
289
307
describe ( 'when the model is undefined/null' , function ( ) {
You can’t perform that action at this time.
0 commit comments