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

35 lines (30 loc) 1.07 kB
import { Component, OnInit, Input } 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 { constructor( public override <%-schemaName%>Service: <%-SchemaName%>Service, public override injector: Injector, public override route: ActivatedRoute ) { super(<%-schemaName%>Service, injector, route); } override ngOnInit() { if (!this.id) this.id = this.inputData; if (this.id) { this.populateDetail(this.id); } else { console.error("Routing error for detail sub view... no id..."); } } override ngAfterViewInit() { // Do nothing. } }