From 4e3788efc3db65bbd811c3b847b383578c0e87f5 Mon Sep 17 00:00:00 2001 From: Andrea Stronati Date: Thu, 22 Jun 2017 18:00:54 +0200 Subject: [PATCH 1/2] Replaced watch on input changes with a watch on model changes --- angularjs-autogrow.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularjs-autogrow.js b/angularjs-autogrow.js index 11b6af4..81ecc75 100644 --- a/angularjs-autogrow.js +++ b/angularjs-autogrow.js @@ -60,7 +60,7 @@ $scope.lineHeight = ($element[0].scrollHeight / $scope.attrs.rows) - ($scope.offset / $scope.attrs.rows); $scope.maxAllowedHeight = ($scope.lineHeight * $scope.attrs.maxLines) - $scope.offset; - $element[0].addEventListener('input', $scope.autogrowFn); + $scope.$watch($attrs.ngModel, $scope.autogrowFn); /** * Auto-resize when there's content on page load @@ -71,4 +71,4 @@ } } }]); -})(); \ No newline at end of file +})(); From dc48045b94b19f978fbd3d37df26b549ff457659 Mon Sep 17 00:00:00 2001 From: Andrea Stronati Date: Thu, 22 Jun 2017 18:04:58 +0200 Subject: [PATCH 2/2] Updated to version 0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c3b01d..7ce7abe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angularjs-autogrow", - "version": "0.2.0", + "version": "0.3.0", "description": "AngularJS 1.x directive for auto-grow / auto-resize of textarea elements", "main": "angularjs-autogrow.js", "scripts": {