angular-elastic
angular-elastic copied to clipboard
Model refresh from resize event doesn't works
I'm not shure if it's cauesed by the same bug as #54 , but I found that refresh of model wont be reflected to textarea if you'll do it in resize event http://plnkr.co/edit/wKhuQqq7hJs53d57zx1X?p=preview
For instance, when you want to use elastic TextArea as input for message system and you want to send message -> clear content when user press enter. I was able to distinct resize event when it's caused by pressing enter, but I wasn't able to reproduce it in plunker.. :-/
$scope.$on('elastic:resize', function (event, element, oldHeight, newHeight) {
if (element.context.innerHTML.substr(element.context.innerText.length) === "\n") {
$scope.comment = ""; //Wont refresh immediately, only after you click
}
});
Angular doesn't digest on events. http://stackoverflow.com/questions/22414017/angularjs-why-am-i-needing-scope-apply-within-scope-on. Forcing an digest via $apply, $digest, or using a $timeout should resolve this issue.
Archiving repository.