代码之家  ›  专栏  ›  技术社区  ›  Vahid Ghadiri

使用NGX条码在运行时生成条码

  •  0
  • Vahid Ghadiri  · 技术社区  · 6 年前

    我想遍历循环并从集合中读取序列,并使用以下代码使用NGX条码显示它们:

    <tbody>
    <tr *ngFor="let PS of PrintSerials">
    <ngx-barcode [bc-value]="{{ PS.SerialId }}" [bc-display-value]="true"></ngx-barcode>
    </tr>
    </tbody>
    

    但我得到了这个错误;

    nodeInvokionException:模板分析错误:分析器错误:已获取 插值(),其中表达式应出现在[{{ PS.serialid]英寸 ng:///appmoduleshared/printserialcomponent.html@8:25(“[bc value]=”ps.serialid“[bc display value]=”true“> “):ng:///appmoduleshared/printserialcomponent.html@8:25

    如何显示序列条形码? 谢谢

    2 回复  |  直到 6 年前
        1
  •  1
  •   Jamie Rees    6 年前

    将代码更改为:

    <ngx-barcode [bc-value]="PS.SerialId" [bc-display-value]="true"></ngx-barcode>
    

    [bc-value]

        2
  •  1
  •   Sanoj_V    6 年前

    你需要像 [bc-value]="{{PS.SerialId}}" [bc-value]="PS.SerialId" .

    ngx-barcode working example