UNPKG

@hicoder/angular-cli

Version:

Angular UI componenets and service generator. It works with the mean-rest-express package to generate the end to end web application. The input to this generator is the Mongoose schema defined for the express application. mean-rest-express exposes the Res

34 lines (28 loc) 1.13 kB
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Injector } from '@angular/core'; import { <%-SchemaName%>DetailComponent } from './<%-schemaName%>-detail.component'; import { <%-SchemaName%>Service } from '../<%-schemaName%>.service'; @Component({ <%- include(`/widgets/detail/component.template.custom.ts`)%> }) export class <%-SchemaName%><%-ComponentClassName%>Component extends <%-SchemaName%>DetailComponent implements OnInit { override done = new EventEmitter<boolean>(); constructor( public override <%-schemaName%>Service: <%-SchemaName%>Service, public override injector: Injector, public override route: ActivatedRoute, ) { super(<%-schemaName%>Service, injector, route); this.majorUi = false; } override ngOnInit() { if (!this.id) this.id = this.inputData; if (this.id) this.populateDetail(this.id); else console.error("Routing error for detail view... no id..."); } override ngAfterViewInit() { // Do nothing. } }