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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -