-
0 votesanswersviews
RouterActiveLink不适用于ng-template中的routerLink
我在“Angular 2”中创建了一个包含三个组件的新应用程序: AppComponent Test1Component Test2Component 只有一个模块(AppModule)引导AppComponent,声明AppComponent,Test1Component和Test2Component,并导入 RouterModule.forRoot(appRoutes) . ... -
1 votesanswersviews
在Angular中的单个页面中管理多个模板
我有一个用例,我需要1个视图(模板)根据条件显示在屏幕上 . 他们有超过10个模板可用,但一次只能看到其中一个模板 . 以下哪种解决方案最相关 在每个div上使用ngIf 使用ngSwitch并根据条件显示div 使用模板(如何管理) 任何其他方式..? 我想为每种视图类型使用模板,以便我的代码保持干净和可伸缩 . -
15 votesanswersviews
Angular - ng-template,其中ngIf内的参数在ngFor [duplicate]内
这个问题在这里已有答案: Passing ngFor variable to an ngIf template 3个答案 我正在尝试构建此模板: <ul> <li *ngFor='let link of links'> <ng-container *ngIf="link.type == 'complex'; then comple...