我在 Angular 5 中创建了一个使用 ngTemplateOutlet 的指令,因此我的指令需要一个组件的名称,然后它会动态呈现。
<back-container [componentOutlet]='dynamicComponent' [componentOutletContext]="{'data' : data}"></back-container>
现在我在一个组件中使用这个指令,它将要呈现的组件的引用作为输入。
<tile [dynamicComponent]='instance>
实例在哪里
instance = SpeedometerComponent;
我想在 Angular js 应用程序中使用这个组件,因此我使用 downgradeComponent 来降级组件并在 Angular js 中使用它。
.directive(
'Tile',
downgradeComponent({ component: TileComponent }) as angular.IDirectiveFactory)
如何在 Angular js 应用程序中将组件作为输入传递?我必须在 angular js 中传递的组件是另一个 angular 5 组件