路由参数不是动态更新

时间:2020-06-08 07:05:46

标签: angular

我有一个下拉菜单,单击该下拉菜单中的选项将附加/duplicate/<id>,但是在ID未更新并且出现此错误cannot read property 'component' of null之后,它仅工作一次。ID需要更改从下拉菜单中单击其他选项。预先感谢。

 imports: [RouterModule.forChild([
        { path: '', component: NewEditPracticeComponent, outlet: 'test', canActivate: [AdminGuard] },
        { path: 'duplicate/:courseid', component: NewEditPracticeComponent, canActivate: [AdminGuard],pathMatch: 'full' },
    ]),
    <div *ngIf="test.questions?.length  == test.no_questions">
      <div class="dropdown-toggle" data-toggle="dropdown" style="float: right;">{{selectedCourse}}&nbsp;
      <i class="fa fa-angle-down" style="font-size: 0.7em; font-weight: 600;"></i>
    </div>
    <ul class="dropdown-menu" *ngIf="user['subscribed_courses']">
      <li *ngFor="let item of user['subscribed_courses']" 
      [ngStyle]="{'display':item.acr == selectedCourse ? 'none' : 'block' }" [routerLink]="['duplicate', item?._id ]"
      (click)="selectCourse(item.acr,item._id)">{{item.acr}}</li>
    </ul>
    </div>

0 个答案:

没有答案