This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simplified combination of the following libraries: | |
// https://raw.githubusercontent.com/evseevdev/ngx-textarea-autosize/master/lib/src/autosize.directive.ts | |
// https://raw.githubusercontent.com/chrum/ngx-autosize/master/projects/autosize/src/lib/autosize.directive.ts | |
import { AfterViewInit, Directive, DoCheck, ElementRef, HostBinding, HostListener, Input, Renderer2 } from "@angular/core"; | |
@Directive({ | |
selector: "textarea[grow]" | |
}) | |
export class GrowDirective implements AfterViewInit, DoCheck { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |