html - readonly textarea to fit the content with angularjs -
what easiest way make readonly textarea fit it's content (no scrollbar)? i'm using angularjs , want pure angualrjs, don't want use jquery.
angular.module("app", []) .directive("autoheight", function () { return { restrict: "eac", link: function (scope, element, attrs) { element[0].style.height = (element[0].scrollheight < 30) ? 30 + "px" : element[0].scrollheight + "px"; } }; });
in html:
<textarea auto-height> </textarea>
Comments
Post a Comment