2
내가 동적 탭을 만들 수 valor-software/ngx-bootstrap를 사용하려고 해요하지만 난 동적으로 생성 탭의 컨텐츠 내부 구성 요소의 선택을 데려 가고 싶다는 내부용맹 - 소프트웨어/NGX-부트 스트랩은에서 동적으로 생성 된 컨텐츠
를 구성 요소를 넣어
import { Component, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'demo-tabs-dynamic',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './dynamic.html'
})
export class DemoTabsDynamicComponent {
tabs: any[] = [
{ title: 'Dynamic Title 1', content: 'Dynamic content 1' },
{ title: 'Dynamic Title 2', content: 'Dynamic content 2', disabled:
true },
{ title: 'Dynamic Title 3', content: 'Dynamic content 3',
removable: true }
];
addNewTab(): void {
const newTabIndex = this.tabs.length + 1;
this.tabs.push({
title: `Dynamic Title ${newTabIndex}`,
content: `Dynamic content ${newTabIndex}`,
disabled: false,
removable: true
});
}
}
그리고 나는 이런 식으로 뭔가를 할 수 있도록하려면 : 문서의 예를 들어 우리가
import { Component, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'demo-tabs-dynamic',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './dynamic.html'
})
export class DemoTabsDynamicComponent {
tabs: any[] = [
{ title: 'Dynamic Title 1', content: 'Dynamic content 1' },
{ title: 'Dynamic Title 2', content: 'Dynamic content 2', disabled:
true },
{ title: 'Dynamic Title 3', content: 'Dynamic content 3',
removable: true }
];
addNewTab(): void {
const newTabIndex = this.tabs.length + 1;
this.tabs.push({
title: `Dynamic Title ${newTabIndex}`,
content: `<my-component></my-component>`, // Here is the change
disabled: false,
removable: true
});
}
}
각도 구성 요소를 소독하라고 selector to string 해결 방법이 있습니까?