enable sidebar nav; fix build error

This commit is contained in:
garrettmills
2020-02-08 13:35:07 -06:00
parent bf1be4d3d6
commit 7a504bb8de
6 changed files with 108 additions and 40 deletions

View File

@@ -15,7 +15,7 @@
<ng-container>
<div class="editor-root ion-padding">
<div class="host-container ion-padding">
<editor-host #editorHosts *ngFor="let record of hostRecords" [(record)]="record"
<editor-host #editorHosts *ngFor="let record of hostRecords; let i = index" [(record)]="hostRecords[i]"
(newHostRequested)="onNewHostRequested($event)" (destroyHostRequested)="onDestroyHostRequested($event)">
</editor-host>
</div>
@@ -25,4 +25,4 @@
<ion-button (click)="onSaveClick()" class="ion-padding ion-margin">Save</ion-button>
</div>
</ng-container>
</ion-content>
</ion-content>

View File

@@ -2,6 +2,7 @@ import {Component, Host, OnInit, ViewChild, ViewChildren} from '@angular/core';
import HostRecord from '../../structures/HostRecord';
import PageRecord from '../../structures/PageRecord';
import {PageService} from '../../service/page.service';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-editor',
@@ -11,26 +12,33 @@ import {PageService} from '../../service/page.service';
export class EditorPage implements OnInit {
public hostRecords: Array<HostRecord> = [new HostRecord('Click to edit page...')];
public pageRecord: PageRecord = new PageRecord();
public pageId: string;
@ViewChildren('editorHosts') editorHosts;
@ViewChild('titleBar', {static: false}) titleBar;
constructor(
protected pages: PageService,
) { }
protected route: ActivatedRoute,
) {
this.route.params.subscribe(params => {
this.pageId = params.id;
});
}
ngOnInit() {
console.log('Editor component: ', this);
}
ionViewDidEnter() {
const pageId = prompt('What is the ID of the page to load?');
this.pages.load(pageId).subscribe(pageRecord => {
this.pageRecord = pageRecord;
this.pages.get_nodes(pageRecord).subscribe((hosts: Array<HostRecord>) => {
this.hostRecords = hosts;
if ( this.pageId ) {
this.pages.load(this.pageId).subscribe(pageRecord => {
this.pageRecord = pageRecord;
this.pages.get_nodes(pageRecord).subscribe((hosts: Array<HostRecord>) => {
this.hostRecords = hosts;
});
});
});
}
}
onAddClick() {