Updating the report template
The updating process should be considered as a child to parent interaction. In other words, when we update a value inside one of those accordion elements and hit the save button, we need to trigger a function inside the child component. That's why we need to bind a click event to the save button (the disk icon in the header):
# src/app/report/report-template.html #... <button class="btn btn-default btn-xs pull-right" type="submit" (click)="saveReportTemplate(model)"> <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"> </span> </button> #...
In the component class we need to catch that event--and since all Firebase-related operations are handles in the parent--we need to emit a new event to the parent:
// src/app/report/report-template.component.ts import {Component,Input,EventEmitter,Output} from '@angular/core'; //... export class ReportTemplateComponent { @Input('template') model: ReportConfig; @Output...