首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何生成二维码列表?

如何生成二维码列表?
EN

Stack Overflow用户
提问于 2020-12-26 22:23:00
回答 1查看 74关注 0票数 0

我需要在使用angularx-qrcode (10.0.11)在Angular中调用HTTP GET之后生成一个二维码列表。我不能理解如何将我的客户代码变量传递给<qrcode/>元素。

这是我的简单实现:

代码语言:javascript
复制
<h3>Customers QR</h3>
<li *ngFor="let customer of customers">
    <qrcode [qrdata]="{{customer.code}}" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
</li>
代码语言:javascript
复制
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { environment } from 'src/environments/environment';

@Component({
  selector: 'app-customers-qr',
  templateUrl: './customers-qr.component.html',
  styleUrls: ['./customers-qr.component.scss']
})
export class CustomersQrComponent implements OnInit {
  customers: any[];

  constructor(private http: HttpClient) { }

  ngOnInit(): void {
    this.http.get<any>(`${environment.baseUrl}/customers`).subscribe((customers) => {
      // Assign articles to table
      this.customers = customers;
    });
  }

}

它不起作用。我如何实现我想要的行为?

EN

回答 1

Stack Overflow用户

发布于 2020-12-26 23:04:47

解决方案非常简单:

代码语言:javascript
复制
<qrcode [qrdata]="customer.code" [width]="128" [errorCorrectionLevel]="'M'"></qrcode>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65457313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档