我对 Angular 很陌生。
我想通过单击按钮在组件内有条件地加载子组件。单击按钮时,它应该重新渲染相应的子组件。
HTML代码
<div class="tab">
<button class="tablinks" (click)="onTabClick('0')">Transmit</button>
<button class="tablinks" (click)="onTabClick('1')">Published</button>
<button class="tablinks" (click)="onTabClick('2')">Bulk Transmit</button>
</div>
<div>
<app-sports *ngIf="tabIndex === 0"></app-sports>
<app-movies *ngIf="tabIndex === 2"></app-movies>
</div>
Run Code Online (Sandbox Code Playgroud)
TS文件
tabIndex = 2 ;
onTabClick(index){
this.tabIndex = index;
}
Run Code Online (Sandbox Code Playgroud) 我必须在超过5个动作中使用ofType。
@Effect()
applyInspectionsFilters$: Observable<Action> = this.actions$.pipe(
ofType(
InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type
),
withLatestFrom(
this.store$.pipe(select(fromInspections.getSelectedInspectionsFilters))
),
switchMap(([action, filters]) =>
...
)
);
Run Code Online (Sandbox Code Playgroud)
当其库中参数的最大数量为5时,该怎么办?