See the link above. I want to hide the textarea when the width of the text area is over 400px. How can this be done?
As you're using Angular and you're dealing with view related code, you'd want to define a directive
.
The code below is an example of what this directive would look like (written in CoffeeScript):
angular.module('yourAppName').directive('hideOnExceed', ->
return {
restrict: 'A',
link: (scope, element, attr) ->
element.bind 'resize', ->
if element.width() > 400
element.hide()
else
element.show()
}
)
Then simply define hideOnExceed
as an attribute to the textarea tag:
<textarea ng-show="withinSize()" hideOnExceed>{{size}}</textarea>