[英]how do dynamic reactiveFormsModule with patterns generate by api
I have an angular form group with an input mail but I want to add regex patterns for the extension for only what its in my database.我有一个带有输入邮件的 angular 表单组,但我想为扩展名添加正则表达式模式,仅用于我的数据库中的内容。
My services getAllDomain is done.我的服务 getAllDomain 已完成。
I don't know how to write the regex any word that does not end @ and a word from my list not case-similar我不知道如何编写任何不以 @ 结尾的单词和我列表中的单词不区分大小写的正则表达式
i think trigger action like that [pattern]="patternEmail"
我认为触发这样的动作[pattern]="patternEmail"
getpatternEmail(){
domainList: string[] = [];
this.domainService.getAll().subscribe({
next:(res) => {
domainList=res;
}});
return ".@("+domainList.join('|')+")";
}
Property 'patternEmail' does not exist on type 'CreateComponent'
and if i remove the get Type '() => string' is not assignable to type 'string | RegExp'.
如果我删除 get Type '() => string' is not assignable to type 'string | RegExp'.
Type '() => string' is not assignable to type 'string | RegExp'.
something like this should work像这样的东西应该工作
get patternEmail(): string{
domainList: string[] = [];
this.domainService.getAll().subscribe({
next:(res) => {
domainList=res;
},
error: (e) => {
},
() => {
// 'onCompleted' callback.
// No errors
return ".@("+domainList.join('|')+")";
}
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.