小编Din*_*hah的帖子

Angular 2:Validators.pattern()不起作用

我试图使用模式验证输入类型="文本",我只想要文本.

零件 :

 this.from = this.fb.group({
  name: ['',[Validators.required,Validators.pattern('/^[a-zA-Z]+$/')]],

});
Run Code Online (Sandbox Code Playgroud)

Html:

<input type="text" formControlName="name"/> // omitting other html template like from tag.
Run Code Online (Sandbox Code Playgroud)

以上模式验证对我不起作用,它将始终返回无效状态.

angular

26
推荐指数
6
解决办法
6万
查看次数

Angular 2:AOT TypeError:base64不是函数

我试图用aot编译我的项目,但是当我尝试命令时

ngc -p tsconfig-aot.json

它在第一次使用ngFactroy生成aot文件夹,但是当我更改主要ts(如角度文档中提到的)为bootstrap新生成的ngmodulefactory并使用相同的命令重新编译项目时,我得到以下错误

TypeError: base64 is not a function
at Function.from (native)
at Function.from (native)
at Object.extractInlineSourceMap (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/tsickle/build/src/source_map_utils.js:33:19)
at TsickleCompilerHost.stripAndStoreExistingSourceMap (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/tsickle/build/src/tsickle_compiler_host.js:128:48)
at TsickleCompilerHost.getSourceFile (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/tsickle/build/src/tsickle_compiler_host.js:89:25)
at findSourceFile (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/typescript/lib/typescript.js:63453:29)
at processImportedModules (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/typescript/lib/typescript.js:63600:25)
at findSourceFile (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/typescript/lib/typescript.js:63481:17)
at processSourceFile (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/typescript/lib/typescript.js:63384:27)
at processRootFile (/Users/apache-tomcat-7.0.61/webapps/ChatAppAngular/node_modules/typescript/lib/typescript.js:63271:13)
Compilation failed
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么 ?

angularjs angular

5
推荐指数
1
解决办法
796
查看次数

标签 统计

angular ×2

angularjs ×1