This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 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', [])
272272 ngModel . $render = function ( ) {
273273 session . setValue ( ngModel . $viewValue ) ;
274274 } ;
275+
276+ acee . on ( 'change' , function ( ) {
277+ ngModel . $setViewValue ( acee . getValue ( ) ) ;
278+ } ) ;
275279 }
276280
277281 // Listen for option updates
Original file line number Diff line number Diff line change @@ -284,6 +284,24 @@ describe('uiAce', function () {
284284 //
285285 expect ( scope . foo ) . toBe ( 'baz' ) ;
286286 } ) ;
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+ } ) ;
287305 } ) ;
288306
289307 describe ( 'when the model is undefined/null' , function ( ) {
You can’t perform that action at this time.
0 commit comments