我需要在使用angularx-qrcode (10.0.11)在Angular中调用HTTP GET之后生成一个二维码列表。我不能理解如何将我的客户代码变量传递给<qrcode/>元素。
这是我的简单实现:
<h3>Customers QR</h3>
<li *ngFor="let customer of customers">
<qrcode [qrdata]="{{customer.code}}" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
</li>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;
});
}
}它不起作用。我如何实现我想要的行为?
发布于 2020-12-26 23:04:47
解决方案非常简单:
<qrcode [qrdata]="customer.code" [width]="128" [errorCorrectionLevel]="'M'"></qrcode>https://stackoverflow.com/questions/65457313
复制相似问题