【问题标题】:Data Bind RouterLink (Angular 2) - Got interpolation ({{}}) where expression was expected at column 3数据绑定 RouterLink (Angular 2) - 得到插值 ({{}}),其中表达式应位于第 3 列
【发布时间】:2023-03-04 18:24:01
【问题描述】:

我在将数据传递到我的 routerLink 时遇到了一些问题。这是我正在尝试做的事情:(此输入在 ngFor 内,当 id 达到 4 时我需要更改路由)

 <input type="button" class="btn-cards" [ngClass]="getStyle(negociacao)"  [routerLink]="['/{{negociacao.rota}}', negociacao.id]" value="{{negociacao.status}}">

我得到的错误如下:

得到插值 ({{}}),其中表达式应位于第 3 列

提前致谢:)

【问题讨论】:

    标签: javascript angular routing angular2-routing


    【解决方案1】:

    您不应该在 routerLink 指令中使用 {{}}(interpolation)。

    [routerLink]="['/', negociacao.rota, negociacao.id]"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-25
      • 1970-01-01
      • 2016-08-08
      • 2018-08-30
      • 2019-08-04
      • 1970-01-01
      相关资源
      最近更新 更多