首页 新闻 会员 周边

angular: 使用 angularx-qrcode 遇到问题

0
悬赏园豆:30 [已解决问题] 解决于 2022-10-25 18:39

参照 https://github.com/Cordobo/angularx-qrcode#installation 在 app.component.html 中添加下面的代码

<qrcode [qrdata]="'Your data string'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>

访问时浏览器控制台报错

inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `EnvironmentInjector#runInContext`

请问如何解决?

问题补充:

angular 版本是 14.2.7

换成 angular 12.2.15 则正常,看来对 angular 14 的支持问题

dudu的主页 dudu | 高人七级 | 园豆:30979
提问于:2022-10-25 15:50
< >
分享
最佳答案
0

重新安装 angularx-qrcode 后正常了,可能是之前的 angularx-qrcode 安装有问题

dudu | 高人七级 |园豆:30979 | 2022-10-25 18:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册