angular - 如何在 Angular 11 和 '@aws-amplify/ui-angular' 中删除“amplify-authenticator 不是已知元素”
问题描述
在网上四处寻找答案,没有看到任何东西。可能是因为这并不难诊断和修复,但我想我会发布这个,以便它可以为其他人节省几分钟的时间。
我在使用 AWS Amplify 的 Authenticator 组件时遇到了问题。按照此处的基本设置-> https://docs.amplify.aws/ui/auth/authenticator/q/framework/angular
将 Amplify Angular UI 组件添加到我的 app.component.html 后,我的 IDE(VS 代码)抱怨它无法识别 UI 组件。文档中没有关于如何解决这个问题的任何内容。
解决方案
IDE 抱怨的原因是这些是 Web 组件,因此您需要将 CUSTOM_ELEMENTS_SCHEMA 添加到您的模块中
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
AmplifyUIAngularModule,
AppRoutingModule,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA], // <---this right here
providers: [],
bootstrap: [AppComponent],
})
推荐阅读
- hadoop - Hadoop 表源详细信息
- c# - 将 Guid 传递给存储过程会引发 Microsoft.Data.SqlClient.SqlException:“'@Id' 附近的语法不正确。”
- php - 我想用 php 和 WebRTC 创建一个实时视频流媒体网站
- javascript - 为什么我的 setState 不接受这个对象?
- java - String.replace() 正在删除我没有告诉它的部分字符串
- algorithm - 就时间复杂度而言,自下而上的 DP 解决方案是否优于自上而下?
- php - 如何使 Eloquent 模型属性只能通过公共方法更新?
- ios - Swift 5 - 枚举内的枚举
- python - 如何在 Pandas 中枚举和拆分 csv 列?
- regex - 选择特殊字符之前的所有子字符串