I declare a summary template in Base component. In form component, I have four tabs, when user clicks the last tab, I render the summary template. Is it necessary to get summary template ref only when user click the last tab? Any advantages?
In Base component
<ng-template #appSummary let-summary>xx</ng-template>
getAppSummaryRef(): TemplateRef<any> {
return this.appSummary ;
}
In form component
constructor(){
this.lastTab$.pipe(distinctUntilChanged()).subscribe((summaryTab: any) => {
this.summaryRef = !!summaryTab ? this.baseComp.getAppSummaryRef() : null;
});
}
Or just
constructor(){
this.summaryRef = this.baseComp.getAppSummaryRef();
}