【发布时间】:2019-01-16 21:52:27
【问题描述】:
您好,我在 AngularJS 中使用 https://hassantariqblog.wordpress.com/2016/07/27/angularjs-textarea-auto-resize-directive/ 根据输入调整文本区域的大小。我正在使用如下模板(description.tpl.html):
<textarea class="form-control" auto-resize placeholder="Please enter description here..." style="resize: none;min-height:100px;" ng-model="description" autofocus></textarea>
我在 2 个地方显示文本区域。但是,当我在下面的选项卡中使用 textarea 时,它的大小不会更新。但是,当我开始输入文本区域时,它会更新大小。
<uib-tab heading= DESCRIPTION >
<div ng-include="'description.tpl.html'"></div>
</uib-tab>
所以我试图添加此代码,选择选项卡时,如何调用该指令?
element.css({ 'height': 'auto', 'overflow-y': 'hidden' });
element.css('height', element[0].scrollHeight + 'px');
提前致谢!
【问题讨论】:
标签: angularjs angularjs-directive textarea