@@ -9,12 +9,18 @@ angular.module('monospaced.elastic', [])
99
1010 const _self = this ;
1111
12- this . runAngularOutside = null ;
12+ this . ngZone = null ;
1313
14- this . setRunAngularOutsideFn = function ( fn ) {
15- _self . runAngularOutside = fn ;
14+ this . $get = function ( ) {
15+ return {
16+ getNgZone : function ( ) {
17+ return _self . ngZone ;
18+ } ,
19+ setNgZoneProvider : function ( ngZone ) {
20+ _self . ngZone = ngZone ;
21+ }
22+ } ;
1623 } ;
17-
1824 } ] )
1925 . constant ( 'msdElasticConfig' , {
2026 append : ''
@@ -26,7 +32,7 @@ angular.module('monospaced.elastic', [])
2632 'use strict' ;
2733
2834 return {
29- require : 'ngModel' ,
35+ // require: 'ngModel',
3036 restrict : 'A, C' ,
3137 link : function ( scope , element , attrs , ngModel ) {
3238
@@ -199,18 +205,18 @@ angular.module('monospaced.elastic', [])
199205 $win . bind ( 'resize' , forceAdjust ) ;
200206 } ;
201207
202- if ( msdElasticProvider . runAngularOutside ) {
203- msdElasticProvider . runAngularOutside ( ( ) => {
208+ if ( msdElasticProvider . getNgZone ( ) ) {
209+ msdElasticProvider . getNgZone ( ) . runOutsideAngular ( ( ) => {
204210 listen ( ) ;
205211 } ) ;
206212 } else {
207213 listen ( ) ;
208214 }
209215 scope . $watch ( function ( ) {
210216 if ( scope . maxHeight && scope . maxHeight != maxHeight ) {
211- maxHeight = scope . maxHeight
217+ maxHeight = scope . maxHeight ;
212218 }
213- return ngModel . $modelValue ;
219+ return ngModel ? ngModel . $modelValue : null ;
214220 } , function ( newValue ) {
215221 forceAdjust ( ) ;
216222 } ) ;
@@ -220,7 +226,9 @@ angular.module('monospaced.elastic', [])
220226 forceAdjust ( ) ;
221227 } ) ;
222228
223- $timeout ( function ( ) { adjust } , 5000 ) ;
229+ $timeout ( function ( ) {
230+ adjust ;
231+ } , 5000 ) ;
224232
225233 /*
226234 * destroy
0 commit comments