I have a textarea, which should be resized to the scrollHeight when it is loaded. I have no problem with key events to resize the textarea like this:
$scope.resize= function (event) {
//Auto size:
var element = typeof event === 'object' ? event.target : document.getElementById(event);
var scrollHeight = element.scrollHeight - 60;
element.style.height = scrollHeight + "px";
}
But I can not resize it, when the element is loaded. I tried with $element and $element[0], but I noticed that the height of $element is 0. And I don't want to fit the height by window height (I can get window height by $window). Is there any way to get the element.height and element.scrollHeight after loading the element in angular?