UNPKG

my-test123

Version:
34 lines 1.23 kB
import { ElementRef, HostListener, Directive, Input } from '@angular/core'; var Autosize = /** @class */ (function () { function Autosize(element) { this.element = element; this.init_height = 0; } Autosize.prototype.onInput = function (textArea) { this.adjust(); }; Autosize.prototype.ngAfterContentChecked = function () { this.adjust(); }; Autosize.prototype.adjust = function () { this.element.nativeElement.style.overflow = 'hidden'; this.element.nativeElement.style.height = this.init_height ? this.init_height + 'px' : 'auto'; this.element.nativeElement.style.height = this.element.nativeElement.scrollHeight + 'px'; }; Autosize.decorators = [ { type: Directive, args: [{ selector: 'textarea[autosize]' },] }, ]; /** @nocollapse */ Autosize.ctorParameters = function () { return [ { type: ElementRef, }, ]; }; Autosize.propDecorators = { 'init_height': [{ type: Input },], 'onInput': [{ type: HostListener, args: ['input', ['$event.target'],] },], }; return Autosize; }()); export { Autosize }; //# sourceMappingURL=autosize.directive.js.map