Skip to content

Commit b7b7b8f

Browse files
committed
2.5.14
1 parent 80380eb commit b7b7b8f

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

elastic.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-elastic",
3-
"version": "2.5.13",
3+
"version": "2.5.14",
44
"description": "Elastic (autosize) textareas for AngularJS, without jQuery dependency.",
55
"keywords": [
66
"angular",

0 commit comments

Comments
 (0)