UNPKG

ws-form-builder

Version:
56 lines 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var form_builder_1 = require("../../providers/form-builder/form-builder"); var WsProfilePictureComponent = (function () { function WsProfilePictureComponent(formBuilder) { this.formBuilder = formBuilder; this.answerGiven = new core_1.EventEmitter(); this.fieldValue = ''; this.isFieldValid = false; this.showError = false; this.fieldValue = ''; } WsProfilePictureComponent.prototype.ngOnInit = function () { if (typeof this.question.value !== 'undefined') { this.fieldValue = this.question.value; } }; WsProfilePictureComponent.prototype.setAnswer = function (event, question) { var isStringValid = this.validateAnswer(question, event.value); if (!isStringValid) { this.isFieldValid = false; this.showError = true; } else { this.isFieldValid = true; this.showError = false; } if (this.isFieldValid) { question.value = event.value; question.valid = true; this.answerGiven.emit(question); } }; WsProfilePictureComponent.prototype.validateAnswer = function (question, string) { return this.formBuilder.validateAnswer(question, string); }; WsProfilePictureComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'ws-profile-picture', template: "\n Profile picture module\n ", styles: ["\n\n "] },] }, ]; /** @nocollapse */ WsProfilePictureComponent.ctorParameters = function () { return [ { type: form_builder_1.FormBuilderProvider, }, ]; }; WsProfilePictureComponent.propDecorators = { "question": [{ type: core_1.Input, args: ['question',] },], "answerGiven": [{ type: core_1.Output },], }; return WsProfilePictureComponent; }()); exports.WsProfilePictureComponent = WsProfilePictureComponent; //# sourceMappingURL=ws-profile-picture.js.map