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: ...

Get Angular Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.