angular - 自定义 AWS Amplify cognito 登录/注册组件?

标签 angular typescript amazon-web-services amazon-cognito aws-amplify

在教程中 - https://medium.com/@nickwang_58849/i-got-the-following-error-after-following-the-steps-82757cfaf9f0 ,它使用npm包@aws-amplify/authamplify-authenticator来登录和注册。

auth.component.html只有一行,

<amplify-authenticator></amplify-authenticator>

auth.component.ts

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-auth',
  templateUrl: './auth.component.html',
  styleUrls: ['./auth.component.css']
})
export class AuthComponent implements OnInit {
  constructor() { }
  ngOnInit() {
  }
}

但是,我需要自定义登录(注册时需要添加一些必需的属性。并且需要设计登录/注册控件的样式)。怎么做?

是否有用户编写登录 UI 并仅调用身份验证(通过放大?)登录 Cognito 的示例?

最佳答案

need to style the login/register controls. How to do it?

如果您使用的是最新的 Amplify 模块(2020 年 4 月),您可以使用 CSS 自定义外观:

:root {
  --amplify-primary-color: #008000;
  --amplify-primary-tint: #0000FF; 
  --amplify-primary-shade: #008000;
}

您可以自定义文本:

<AmplifySignIn headerText="My Custom Sign In Header" slot="sign-in" />
<AmplifySignUp headerText="My Customer Sign Up Header" slot="sign-up" />

文档:https://aws-amplify.github.io/docs/js/ui-components#customization

教程从头开始:https://aws.amazon.com/blogs/mobile/amplify-framework-announces-new-rearchitected-ui-component-and-modular-javascript-libraries/

迁移到最新的 UI 包: https://aws-amplify.github.io/docs/js/ui-components#migration-guide

关于angular - 自定义 AWS Amplify cognito 登录/注册组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54193294/

相关文章:

html - 如何在 ng-template 中获取索引值以用于 Primeng 下拉列表

reactjs - 如何让 TypeScript 引擎允许 JSX 中的自定义 HTML 属性?

typescript - 为什么在vite中不能使用reflect-metadata

amazon-web-services - 将域从一个 AWS 账户转移到另一个 AWS 账户

css - 在 index.html 中导入 css 和在 Angular 5 中导入 styleUrls 之间的区别

templates - Angular2如何实现上百页的网站

angular - 使用@canActivate的Dart angular2

javascript - 从构造函数调用方法 : Error: Uncaught TypeError: undefined is not a function

amazon-web-services - 如何使用无服务器模板将 lambda 当前/执行版本放入环境变量中

css - S3 CSS 资源未加载,但之前已加载。为什么会停下来呢?