/** * 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]); }); }); } }; }]) });