0

我正在使用 nodejs 循环返回作为后端的角度应用程序,我想通过单击按钮删除资源:

<a
      *ngIf="current.role < 3"
      class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button-red"
      routerLink="/remove-visitor/{{ curr.id }}"
      >Remove</a
    >

其中的路径在 app.routing.ts 中定义如下:

{
    path: 'remove-visitor/:id',
    component: RemoveVisitorComponent,
    canActivate: [AuthGuardIn],
  },

而移除访问者组件功能是

remove() {
    this.hideFlag = false;
    console.log("Inside remove visitor");
    this.http.delete('/api/visitors/' + this.curr.id + "?access_token=" + this.token)
      .subscribe(
        session => {
          this.hideFlag = true;
          this.toastr.success('Removed!');
          this.router.navigate(['visitors']);
        },
        error => {
          this.hideFlag = true;
        });
  }

但它给我的错误是它没有找到任何匹配的路线。可能是什么问题?尝试过像这样更改前端调用

[routerLink]="['/remove-visitor', curr.id]"

张贴在这里

但这也无济于事。

4

0 回答 0