ボタンをクリックすることで、コンポーネントファクトリを使用して複数のドロップダウンを追加しています。私は新しいドロップダウンを追加するたびに、前のページの上に表示されます。これは問題です。下に必要です。同じタイプの他のコンポーネントと関連して新しいコンポーネントの位置を設定する方法はありますか?動的に作成されたコンポーネントの角度2の位置
@ViewChild('additionalDropdown', { read: ViewContainerRef })
private additionalDropdown: any;
...
let componentFactory = this.resolver.resolveComponentFactory(MultiselectComponent);
let componentRef = this.additionalDropdown.createComponent(componentFactory, 0, this.additionalDropdown.injector)
テンプレート:
<ng-container #additionalDropdown></ng-container>
これは「css」の問題ではありませんか?あなたはそれらを配置しようとしましたか? – lexith