• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript common.Validators类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中angular2/common.Validators的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators类的具体用法?TypeScript Validators怎么用?TypeScript Validators使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Validators类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 constructor(fb: FormBuilder, private pass: PasswordService){
     this.form = fb.group({
         currentpass:['',Validators.compose([
                     Validators.required
                 ]        
         )],
         newpass:['', Validators.compose([
                     Validators.required,
                     Validators.minLength(5)
                 ]
         )],
         confirmpass:['', Validators.compose([
                         Validators.required                          
         ])
             
         ]
     },
     {
         validator: PasswordValidator.shouldBeEqual
     })
 }
开发者ID:cristianmurillo87,项目名称:cursoAngular2,代码行数:21,代码来源:password.component.ts


示例2: constructor

	constructor(private builder: FormBuilder) {
		
		this.username = new Control(
			"", 
			Validators.compose([Validators.required, UsernameValidator.startsWithNumber]),
			UsernameValidator.usernameTaken
		);
		
		this.form = builder.group({
			username:  this.username
		});
	}	
开发者ID:TitoAgudelo,项目名称:angular2-form-validation-example,代码行数:12,代码来源:app.ts


示例3: constructor

	constructor(
		fb: FormBuilder,
		private _router: Router,
		public globalValService:GlobalValService,
		public authService: AuthService) {
		this.signinForm = fb.group({
			'email': ['', Validators.compose([
				Validators.minLength(3),
				Validators.maxLength(30),
				Validators.required,
				emailValidator
				])],
			'password': ['', Validators.required],
			'captcha': ['', Validators.compose([
				Validators.minLength(6),
				Validators.maxLength(6),
				Validators.required
			])]
		})
		this.email = this.signinForm.controls['email']
		this.password = this.signinForm.controls['password']
		this.captcha = this.signinForm.controls['captcha']
		this.globalValService.captchaUrlSubject.subscribe((captchaUrl:string) => {
			this.captchaUrl = captchaUrl
		})
		this.authService.snsLoginsSubject.subscribe((logins:string[])=>{
			this.logins = logins
		})
	}
开发者ID:KennyLisc,项目名称:jackblog-angular2,代码行数:29,代码来源:index.ts


示例4: constructor

 constructor(fb: FormBuilder){
     this.form = fb.group({
         curr_passw: ['', Validators.compose(
             [Validators.required,
                 PasswordValidators.cannotContainSpace,
             ]),
             PasswordValidators.shouldBeUnique
         ],
         new_password: ['', Validators.compose(
             [Validators.required,
                 PasswordValidators.cannotContainSpace,
             ]),
             PasswordValidators.shouldBeUnique
         ],
         confirm_password: ['', Validators.compose(
             [Validators.required,
                 PasswordValidators.cannotContainSpace,
             ]),
             PasswordValidators.shouldBeUnique
         ]
     }, {validator: PasswordValidators.shouldBeSame});
 }
开发者ID:fscbest,项目名称:angular2-seed,代码行数:22,代码来源:change_passw-form.component.ts


示例5: constructor

    constructor(
        formBuilder: FormBuilder,
        authValidationService: AuthValidationService,
        authService: AuthService,
        router: Router) {

        this._loginForm = formBuilder.group({
            'email': [
                '',
                Validators.compose([
                    Validators.required,
                    authValidationService.emailValidator
                ])],
            'password': [
                '',
                Validators.compose([
                    Validators.required
                ])]
        });
        this._authService = authService;
        this._router = router;
    }
开发者ID:GazousGit,项目名称:Angular2-struct,代码行数:22,代码来源:login-form.component.ts


示例6: ngOnInit

    public ngOnInit() {
        this.control = new Control(
            "",
            Validators.compose([
                Validators.required,
                this.keyFormatValidator,
                this.keyTypeValidator.bind(this),
                this.originMatchValidator.bind(this),
            ])
        );

        this.form.addControl("key", this.control);
    }
开发者ID:davidwrede,项目名称:habitat,代码行数:13,代码来源:KeyAddFormComponent.ts


示例7: constructor

 constructor(fb: FormBuilder){
     this.form = fb.group({
         username: [
             '',
             Validators.compose([
                 Validators.required,
                 UsernameValidators.cannotContainSpace
             ]),
             UsernameValidators.shouldBeUnique
         ],
         password: ['', Validators.required]
     });
 }
开发者ID:briveramelo,项目名称:angular2demo,代码行数:13,代码来源:signup-form.component.ts


示例8: constructor

 constructor(fb: FormBuilder) { //good for big form
   this.form1 = fb.group({
     username:[
       'default',
       Validators.compose([
         Validators.required,
         UsernameValidators.cannotContainSpace
       ]),
       UsernameValidators.shouldBeUnique
     ], //default value, validators, async validators
     password: ['', Validators.required]
   })
 }
开发者ID:valmassoi,项目名称:udemy-angular-2-tutorial,代码行数:13,代码来源:signup-form.component.ts


示例9: it

      it("should collect errors from all the validators", fakeAsync(() => {
           var c = Validators.composeAsync([
             asyncValidator("expected", {"one": true}),
             asyncValidator("expected", {"two": true})
           ]);

           var value = null;
           c(new Control("invalid")).then(v => value = v);

           tick(1);

           expect(value).toEqual({"one": true, "two": true});
         }));
开发者ID:Ashok-Pal,项目名称:angular,代码行数:13,代码来源:validators_spec.ts


示例10: ngOnInit

 ngOnInit(){
     this.myForm = this._fb.group({
         firstName: ['', Validators.required],
         lastName: ['', Validators.required],
         email: ['', Validators.compose([
             Validators.required,
             this.isEmail
         ])],
         password: ['', Validators.required],
     })
     
     
 }
开发者ID:gratawa,项目名称:udmMessages,代码行数:13,代码来源:signup.component.ts



注:本文中的angular2/common.Validators类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript testing.ComponentFixture类代码示例发布时间:2022-05-25
下一篇:
TypeScript common.FormBuilder类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap