Answer the question
In order to leave comments, you need to log in
How to make tabs in Angular like this?
Perhaps someone will prompt in what direction to think.
It is necessary to make tabs, in the headers and content of which html or other components could be passed.
<app-tabs>
<app-tab *ngFor="let tab of tabs">
<app-tab-title>
<b>Title</b> of tab {{tab}}
</app-tab-title>
<app-tab-component>
<b>Title</b> of tab {{tab}}
<some-component [tab]="tab"></some-component>
</app-tab-component>
</app-tab>
</app-tabs>
Answer the question
In order to leave comments, you need to log in
In the component template, use<ng-content></ng-content>
@Component({
selector: 'app-tab',
template: `<ng-content></ng-content>`
})
@Component({
selector: 'app-tab-title',
template: `<ng-content></ng-content>`
})
Look in this direction https://www.npmjs.com/package/@codehint-ng/tabs
Here you can put anything in headers and tab content can be placed in arbitrary components in arbitrary places.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question