Hello I have problem with auto grow textarea.
The auto grow textarea working very fine, the problem is the view scrolling.
The problem happens only in ion-scroll (overflow-scroll=“false”), without ion-scroll it’s working fine.
HTML:
<ion-content>
<form name="comment.form" ng-submit="submitComment()">
<textarea ng-model="comment.data.content" auto-grow></textarea>
</form>
</ion-content>
Javascript:
angular.module('myapp')
.directive('autoGrow', autoGrow);
autoGrow.$inject = [];
function autoGrow() {
return {
restrict: 'A',
require: 'ngModel',
scope: {
ngModel: '='
},
link: function(scope, element, attr) {
var update = function() {
element.css("height", "auto");
var height = element[0].scrollHeight;
element.css("height", element[0].scrollHeight + "px");
};
scope.$watch('ngModel', function() {
update();
});
}
};
};
Video: