UNPKG

ws-form-builder

Version:
34 lines 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var Autofocuser = (function () { function Autofocuser(element, renderer) { this.element = element; this.renderer = renderer; } Autofocuser.prototype.ngAfterViewInit = function () { var _this = this; var el = this.element.nativeElement.children[0]; el.addEventListener('blur', function (event) { _this.stopBubble(event); _this.renderer.invokeElementMethod(el, 'focus', []); }); }; Autofocuser.prototype.stopBubble = function (event) { event.preventDefault(); event.stopPropagation(); //Stops event bubbling }; Autofocuser.decorators = [ { type: core_1.Directive, args: [{ selector: '[autofocuser]' },] }, ]; /** @nocollapse */ Autofocuser.ctorParameters = function () { return [ { type: core_1.ElementRef, }, { type: core_1.Renderer, }, ]; }; return Autofocuser; }()); exports.Autofocuser = Autofocuser; //# sourceMappingURL=autofocuser.js.map