我想在标签组件中调用子组件选项卡。
ParentComponent.html
<tabset>
<tab *ngFor="let tabz of tabs"
[heading]="tabz.title"
[active]="tabz.active"
(select)="tabz.active = true"
(deselect)="tabz.active = false"
[disabled]="tabz.disabled"
[removable]="tabz.removable"
(removed)="removeTabHandler(tabz)"
[customClass]="tabz.customClass">
{{tabz?.content}}
</tab>
</tabset>
ParentComponent.ts:
public tabs: any[] = [
{title: 'Tab1', content: '<childComponent1> </childComponent1>'},
{title: 'Tab2', content: '<childComponent2> </childComponent2>', disabled: true},
{title: 'Tab3', content: '<childComponent3> </childComponent3>', removable: true}
];
Childcomponent1.ts
@Component({
selector: 'childComponent1',
templateUrl: './childComponent1.component.html',
styleUrls: ['./childComponent1.component.scss'],
providers: [ ComponentService]
})
我在ng2-bootstrap文档中搜索但是他们没有选择器的属性。如果我在tabset之外提供子选择器,它不在标签中工作。对此有任何建议