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

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -