【发布时间】:2023-01-09 20:36:38
【问题描述】:
我在我的角度项目上使用 mdb,我想在我的密码输入上显示一个工具提示,以向用户显示限制。
我尝试将 data-mdb-toggle="tooltip" 及其旁边的标题放在 html 输入标记中,但我看到必须初始化 mdb 工具提示。我现在不知道如何使用 Typescript,这是我的 .ts 文件:
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
registerForm!: FormGroup;
constructor() { }
ngOnInit(): void {
this.registerForm = new FormGroup({
nome: new FormControl(null, Validators.required),
cognome: new FormControl(null, Validators.required),
team: new FormControl(null, Validators.required),
genere: new FormControl(null, Validators.required),
anno: new FormControl(null, [Validators.required, Validators.max(2005), Validators.min(1964)]),
email: new FormControl(null, [Validators.required, Validators.email]),
password: new FormControl(null, [Validators.required,Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&].{8,}')])
})
}
onSubmit() {
console.log(this.registerForm)
}
}````
【问题讨论】:
-
也请分享模板文件代码。
标签: angular typescript mdbootstrap