@@ -9,12 +9,18 @@ angular.module('monospaced.elastic', [])
9
9
10
10
const _self = this ;
11
11
12
- this . runAngularOutside = null ;
12
+ this . ngZone = null ;
13
13
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
+ } ;
16
23
} ;
17
-
18
24
} ] )
19
25
. constant ( 'msdElasticConfig' , {
20
26
append : ''
@@ -26,7 +32,7 @@ angular.module('monospaced.elastic', [])
26
32
'use strict' ;
27
33
28
34
return {
29
- require : 'ngModel' ,
35
+ // require: 'ngModel',
30
36
restrict : 'A, C' ,
31
37
link : function ( scope , element , attrs , ngModel ) {
32
38
@@ -199,18 +205,18 @@ angular.module('monospaced.elastic', [])
199
205
$win . bind ( 'resize' , forceAdjust ) ;
200
206
} ;
201
207
202
- if ( msdElasticProvider . runAngularOutside ) {
203
- msdElasticProvider . runAngularOutside ( ( ) => {
208
+ if ( msdElasticProvider . getNgZone ( ) ) {
209
+ msdElasticProvider . getNgZone ( ) . runOutsideAngular ( ( ) => {
204
210
listen ( ) ;
205
211
} ) ;
206
212
} else {
207
213
listen ( ) ;
208
214
}
209
215
scope . $watch ( function ( ) {
210
216
if ( scope . maxHeight && scope . maxHeight != maxHeight ) {
211
- maxHeight = scope . maxHeight
217
+ maxHeight = scope . maxHeight ;
212
218
}
213
- return ngModel . $modelValue ;
219
+ return ngModel ? ngModel . $modelValue : null ;
214
220
} , function ( newValue ) {
215
221
forceAdjust ( ) ;
216
222
} ) ;
@@ -220,7 +226,9 @@ angular.module('monospaced.elastic', [])
220
226
forceAdjust ( ) ;
221
227
} ) ;
222
228
223
- $timeout ( function ( ) { adjust } , 5000 ) ;
229
+ $timeout ( function ( ) {
230
+ adjust ;
231
+ } , 5000 ) ;
224
232
225
233
/*
226
234
* destroy
0 commit comments