1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| /**
| * Created by wisestone on 2018-03-23.
| */
| 'use strict';
|
| define(['app',
| 'angular'],
| function (app, angular) {
|
| app.directive('owlAutoTextHeight', ["$timeout", "$log",
| function ($timeout, $log) {
| return {
| restrict : 'A',
| link : function (scope, element, attr) {
|
| function textAreaResize(obj) {
| obj.style.height = "1px";
| obj.style.height = (12 + obj.scrollHeight) + "px";
| }
|
| element.focus(function () {
| textAreaResize(this);
| });
|
| element.bind("input", function () {
| textAreaResize(this);
| });
|
|
| scope.$on("dynamicTextareaHeight", function (event, args) {
| $timeout(function () {
| textAreaResize($(element)[0]);
| });
| });
| }
| };
| }])
| });
|
|