I'm a beginner in angular and need to create some tabs. I found a very interesting example, but I am not able to implement everything in the same component and without the tab component template.
Is there any way to pass all the content from the component tab to the component app?
I intend this code (tab component) to be transferred to the app component and all the html code in the template will be transferred to app.component.html. is it possible to implement this?
Thank you.
import { Component, Input } from '@angular/core';
@Component({
selector: 'tabs',
template: `
<mat-tab-group>
<ng-container *ngFor="let tab of tabsName">
<mat-tab label="{{ tab.name }}">
<ng-container [ngTemplateOutlet]='tab.template'></ng-container>
</mat-tab>
</ng-container>
</mat-tab-group>
<ng-content></ng-content>
`,
styles: [`h1 { font-family: Lato; }`]
})
export class TabComponent {
@Input() tabsName: any;
onSelect(event){
console.log(this.tabsName[0].name)
}
}