nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
56 lines • 2.96 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
import { CustomComponentService } from '../custom-component.service';
import { ContextService } from '../context.service';
import { LoggerService } from '../logger.service';
import { UrlManagerService } from '../url-manager.service';
var DynamicErrorComponent = (function () {
function DynamicErrorComponent(context, componentFactoryResolver, customComponentService, loggerService, urlManagerService) {
this.context = context;
this.componentFactoryResolver = componentFactoryResolver;
this.customComponentService = customComponentService;
this.loggerService = loggerService;
this.urlManagerService = urlManagerService;
}
DynamicErrorComponent.prototype.ngOnInit = function () {
var _this = this;
var errorWrapper = this.context.getError();
if (errorWrapper) {
this.customComponentService.getCustomErrorComponent(errorWrapper.category, errorWrapper.httpErrorCode | errorWrapper.clientErrorCode).then(function (c) {
var childComponent = _this.componentFactoryResolver.resolveComponentFactory(c);
_this.parent.createComponent(childComponent);
});
}
else {
this.loggerService.warn("No error found returning to home page");
this.urlManagerService.setHomeSinglePane();
}
};
return DynamicErrorComponent;
}());
__decorate([
ViewChild('parent', { read: ViewContainerRef }),
__metadata("design:type", ViewContainerRef)
], DynamicErrorComponent.prototype, "parent", void 0);
DynamicErrorComponent = __decorate([
Component({
selector: 'nof-dynamic-error',
template: require('./dynamic-error.component.html'),
styles: [require('./dynamic-error.component.css')]
}),
__metadata("design:paramtypes", [ContextService,
ComponentFactoryResolver,
CustomComponentService,
LoggerService,
UrlManagerService])
], DynamicErrorComponent);
export { DynamicErrorComponent };
//# sourceMappingURL=dynamic-error.component.js.map