Tuesday, 15 January 2013

css - Can't change height using AngularJS -



css - Can't change height using AngularJS -

i'm trying alter height of textarea using angularjs within directive. add together attribute auto-resize textarea , have directive defined as:

app.directive('autoresize',function(){ homecoming { restrict: 'a', //scope: {}, replace: false, link: function(scope, element, attrs) { element.css({ 'overflow': 'hidden', 'color': 'red', 'height': '50px' }); } } }

the color , overflow styles implemented onto textarea, height of text-area not go 50px.

any help appreciated.

you should set rows attribute on textarea rather changing height through css.

app.directive('autoresize',function(){ homecoming { restrict: 'a', //scope: {}, replace: false, link: function(scope, element, attrs) { element.css({ 'overflow': 'hidden', 'color': 'red' }); element.attr("rows", 5); } } }

http://www.w3schools.com/tags/att_textarea_rows.asp

css angularjs

No comments:

Post a Comment