UNPKG

bitfront-library

Version:

Angular CLI project with components and classes used by other Angular projects of the BIT foundation.

74 lines 3.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BitNotificationFrontComponent = void 0; var core_1 = require("@angular/core"); var message_service_1 = require("../../shared/service/message.service"); var idioma_1 = require("../../shared/data/idioma"); var i0 = require("@angular/core"); var i1 = require("../../shared/service/message.service"); var i2 = require("@angular/common"); function BitNotificationFrontComponent_div_0_span_4_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span"); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { var ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵadvance(1); i0.ɵɵtextInterpolate1("(", ctx_r1.masInfo, ")"); } } function BitNotificationFrontComponent_div_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 1); i0.ɵɵelementStart(1, "b"); i0.ɵɵtext(2, "Error:"); i0.ɵɵelementEnd(); i0.ɵɵtext(3); i0.ɵɵtemplate(4, BitNotificationFrontComponent_div_0_span_4_Template, 2, 1, "span", 2); i0.ɵɵelementEnd(); } if (rf & 2) { var ctx_r0 = i0.ɵɵnextContext(); i0.ɵɵadvance(3); i0.ɵɵtextInterpolate1(" ", ctx_r0.error, " "); i0.ɵɵadvance(1); i0.ɵɵproperty("ngIf", ctx_r0.masInfo); } } var BitNotificationFrontComponent = /** @class */ (function () { function BitNotificationFrontComponent(messageService) { var _this = this; // Nos suscribimos a la espera de que envíen notificaciones de error this.subscriptionErrors = messageService.observableNotificationsErrors.subscribe(function (error) { _this.showError(error); }); this.subscriptionErrors = messageService.observableErrors.subscribe(function (message) { _this.showError(message); }); } BitNotificationFrontComponent.prototype.showError = function (error) { this.error = idioma_1.Idioma.esEspanyolSeleccionado() ? error.textES : error.textCA; this.masInfo = error.masInfo; window.scrollTo(0, 0); }; BitNotificationFrontComponent.prototype.cleanError = function () { this.error = null; }; BitNotificationFrontComponent.prototype.ngOnDestroy = function () { // Prevent memory leak when component destroyed this.error = null; this.subscriptionErrors.unsubscribe(); }; BitNotificationFrontComponent.ɵfac = function BitNotificationFrontComponent_Factory(t) { return new (t || BitNotificationFrontComponent)(i0.ɵɵdirectiveInject(i1.MessageService)); }; BitNotificationFrontComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BitNotificationFrontComponent, selectors: [["bit-notification-front"]], decls: 1, vars: 1, consts: [["class", "alert alert-danger margin-top-20", "role", "alert", 4, "ngIf"], ["role", "alert", 1, "alert", "alert-danger", "margin-top-20"], [4, "ngIf"]], template: function BitNotificationFrontComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, BitNotificationFrontComponent_div_0_Template, 5, 2, "div", 0); } if (rf & 2) { i0.ɵɵproperty("ngIf", ctx.error); } }, directives: [i2.NgIf], encapsulation: 2 }); return BitNotificationFrontComponent; }()); exports.BitNotificationFrontComponent = BitNotificationFrontComponent; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BitNotificationFrontComponent, [{ type: core_1.Component, args: [{ selector: "bit-notification-front", template: "\n <div class=\"alert alert-danger margin-top-20\" role=\"alert\" *ngIf=\"error\">\n <b>Error:</b> {{ error }} <span *ngIf=\"masInfo\">({{ masInfo }})</span>\n </div>\n " }] }], function () { return [{ type: i1.MessageService }]; }, null); })(); //# sourceMappingURL=bit-notification-front.component.js.map