如何在DivElement
内添加材料成分列表,例如MaterialCheckboxComponent
?
DivElement.children
是List<Element>
,我看不到如何将List<MaterialCheckboxComponent>
转换为List<Element>
。
如何手动完成MaterialCheckboxComponent
的操作?
答案 0 :(得分:0)
https://webdev.dartlang.org/angular/note/faq/component-loading是有关动态添加组件的部分
@Component( selector: 'ad-view', template: r''' This component is sponsored by: <template #currentAd></template> ''', ) class AdViewComponent { final ComponentLoader _loader; AdViewComponent(this._loader); @ViewChild('currentAd', read: ViewContainerRef) ViewContainerRef currentAd; @Input() set component(ComponentFactory component) { _loader.loadNextToLocation(component, currentAd); } }