Creating new report templates
We are ready to create our first--empty--report template and save it to Firebase as an object. Clearly we need to do some modifications on the parent's component. So add the Firebase object and modify the previous templates
property as follows:
//src/app/report/report.component.ts import {FirebaseListObservable, AngularFire} from "angularfire2"; import {ReportConfig} from "./report.config"; //... export class ReportComponent implements OnInit { private templates: FirebaseListObservable<any>; private items = []; constructor(af: AngularFire) { this.templates = af.database.list('/Report/templates'); } ngOnInit() { this.templates.subscribe(data => {this.items = data;}); } newReportTemplate() { this.templates.push(new ReportConfig('untitled333', false, false, false, 0, 0, false, false, false, false, false, {show: false, size: false, distance: false, url: false},0,0) ); }
These changes suggest...