import {Component, ElementRef, NgZone, OnInit, ViewChild} from "@angular/core"; import {Router} from "@angular/router"; import {ApiObject} from "../../shared/##NAME##/apiobject"; import {##SERVICE##} from "../../shared/##NAME##/##NAME##.service"; @Component({ selector: "gen-comp-##NAME##", templateUrl: "pages/##NAME##/##NAME##.html", styleUrls: ["pages/##NAME##/##NAME##-common.css", "pages/##NAME##/##NAME##.css"], }) export class ##COMPONENT## implements OnInit { dataList: Array = []; listLoaded = false; constructor(private _listService: ##SERVICE##, private router: Router) {} ngOnInit() { this._listService.load() .subscribe(loadedData => { loadedData.forEach((dataObject) => { this.dataList.push(dataObject); }); this.listLoaded = true; console.log('List has been loaded.'); }, (error) => { console.log('ERROR!: ' + error); }); } showDetails(event) { this.router.navigate(['/##NAME##', event]); } }