【问题标题】:How do we add a navigation to a mat-chip in angular?我们如何以角度向 mat-chip 添加导航?
【发布时间】:2020-07-13 11:41:15
【问题描述】:

我收到模板解析错误:使用下面的代码,正确的实现是什么?

#代码

 <mat-chip-list #chipList aria-label="Fruit selection">
                            <mat-chip [routerLink]="['templates/,{{ template.name }} ,/edit']" *ngFor="let template of associated_template;" [selectable]="selectable">
                            {{ template.name }}
                            <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
                            </mat-chip>
                            <input [matChipInputFor]="chipList" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur" (matChipInputTokenEnd)="add($event)">
                          </mat-chip-list>

【问题讨论】:

    标签: angularjs angular typescript


    【解决方案1】:

    你不能混合属性绑定和字符串插值

    <mat-chip [routerLink]="['templates/', template.name, '/edit']" *ngFor="let template of associated_template;" [selectable]="selectable">
    

    【讨论】:

    • @R Pasha 为什么 url 上的编辑变成了 %2Fedit ?
    • 导航后
    • template.name的值是什么
    • 应该是 template.id 先生这里是最后的
    • 这和你的路由配置有关。查看stackoverflow.com/questions/36597832/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-11
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    • 2021-07-27
    • 2021-11-10
    • 2021-08-06
    相关资源
    最近更新 更多