【问题标题】:Calling indexed components dynamically in Angular 6在 Angular 6 中动态调用索引组件
【发布时间】:2018-11-17 04:16:07
【问题描述】:

我在不同的组件中创建了我的应用程序的不同布局,我正在使用 *ngIf 条件访问它

<app-layout1 *ngIf="selected==1"></app-layout1>
<app-layout2 *ngIf="selected==2"></app-layout2>
<app-layout3 *ngIf="selected==3"></app-layout3>

我想知道我们是否有更有效的方法来做同样的事情:

<app-layout[selected]></app-layout[selected]>

【问题讨论】:

  • 不,你必须手动给组件 IMO

标签: javascript angular angular-components angular6


【解决方案1】:

不,你必须手动编写组件...

没有捷径可走!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 2019-05-14
    • 2019-06-23
    • 2018-11-30
    • 2023-02-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多