当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Validators.minLength方法代码示例

本文整理汇总了TypeScript中@angular/forms.Validators.minLength方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.minLength方法的具体用法?TypeScript Validators.minLength怎么用?TypeScript Validators.minLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/forms.Validators的用法示例。


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

示例1: ngOnInit

 ngOnInit() {
   this.createForm = this.fb.group({
     make: ["", [Validators.minLength(4), Validators.required]],
     model: ["", [Validators.minLength(4), Validators.required]],
     year: ["", [Validators.min(1950), Validators.max(2050)]],
     description: ["", [Validators.minLength(11)]],
     price: ["", [Validators.min(1)]],
     imageUrl: ["", [Validators.required]],
     material: [""]
   });
 }
开发者ID:stwel,项目名称:SoftUni,代码行数:11,代码来源:create-furniture.component.ts

示例2: constructor

 constructor(public navCtrl: NavController,
             private formBuilder: FormBuilder,
             public toastCtrl: ToastController,
             private userInfoService: UserInfoService,
             private storageService: StorageService) {
     //this.loginForm = new FormGroup({LoginID: new FormControl(),LoginPwd: new FormControl()});
     this.loginForm = this.formBuilder.group({
         //'LoginID': ['admin@163.com', [Validators.required, Validators.pattern('^([a-zA-Z0-9_.]*)((@[a-zA-Z0-9_.]*)\.([a-zA-Z]{2}|[a-zA-Z]{3}))$')]],// 第一个参数是默认值
         'LoginID': ['', [Validators.required, Validators.minLength(4), emailValidator]],// 第一个参数是默认值
         'LoginPwd': ['', [Validators.required, Validators.minLength(6)]]
     });
 }
开发者ID:humbinal,项目名称:ecmascript-items,代码行数:12,代码来源:login.ts

示例3: ngOnInit

 ngOnInit() {
   this.form = this._fb.group({
     email: new FormControl('', [Validators.required, Validators.maxLength(128), AuthenticationValidators.validateEmail]),
     username: new FormControl('',
       [Validators.required, Validators.maxLength(32)],
       [AuthenticationValidators.uniqueUsername(this._profileService, 300)]),
     password: new FormGroup({
       password: new FormControl('', [Validators.required, Validators.minLength(6)]),
       password2: new FormControl('', [Validators.required, Validators.minLength(6)])
     }, AuthenticationValidators.confirmation)
   });
 }
开发者ID:hemadri1982,项目名称:microservice-demo,代码行数:12,代码来源:registration.component.ts

示例4: ngOnInit

 ngOnInit(): void {
   this.contactForm = this.fb.group({
     firstName:['',[Validators.required, Validators.minLength(3)]],
     lastName:['',[Validators.required, Validators.minLength(3)]],
     emailGroup: this.fb.group({
       email: ['',[Validators.required, Validators.pattern("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")]],
       confirmEmail: ['',Validators.required],
     }, { validator: emailMatcher }),
     phone: '',
     notification: 'email',
     rating: ['', ratingRange(1,5)],
   });
 }
开发者ID:vaibahv88sharma,项目名称:GitCodes,代码行数:13,代码来源:contact-submit.component.ts

示例5: constructor

 constructor(private route: ActivatedRoute, fb: FormBuilder, private userService: UserService ) {
   this.passwordForm = fb.group({
     oldPassword: ['', Validators.compose([Validators.required, Validators.minLength(6)])],
     newPasswords: fb.group({
       newPassword1: ['', Validators.compose([Validators.required, Validators.minLength(6)])],
       newPassword2: ['', Validators.compose([Validators.required, Validators.minLength(6)])]
   }, {validator: EqualPasswordsValidator.validate('newPassword1', 'newPassword2')})
 });
   this.oldPassword = this.passwordForm.controls.oldPassword;
   this.newPasswords = this.passwordForm.controls.newPasswords as FormGroup;
   this.newPassword1 = this.newPasswords.controls.newPassword1;
   this.newPassword2 = this.newPasswords.controls.newPassword2;
 }
开发者ID:bigfish-hu,项目名称:remarker,代码行数:13,代码来源:profile.component.ts

示例6: ngOnInit

	ngOnInit(){
		this.signinForm = this.fb.group({
				email: ['', [Validators.required, Validators.minLength(3),Validators.maxLength(30),emailValidator]],
				password: ['', [Validators.required]],
				captcha: ['', [Validators.required,Validators.minLength(6),Validators.maxLength(6)]]
		})
		this.globalValService.captchaUrlSubject.subscribe((captchaUrl:string) => {
			this.captchaUrl = captchaUrl
		})
		this.authService.snsLoginsSubject.subscribe((logins:string[])=>{
			this.logins = logins
		})
	}
开发者ID:jackhutu,项目名称:jackblog-angular2,代码行数:13,代码来源:login.component.ts

示例7: constructor

 constructor(fb: FormBuilder) {
   // 2:校验方法
   this.formModel = fb.group({
     // 第一个元素:初始值,2:校验方法,3:异步校验方法
     username: ['', [Validators.required, Validators.minLength(6)]],
     mobile: ['', mobileValidator, mobileAsyncValidator],
     passwordsGroup: fb.group({
       password: ['', Validators.minLength(6)],
       pconfirm: ['']
     }, {
          validator: equalValidator
        }),
   });
 }
开发者ID:xzylzz,项目名称:practice,代码行数:14,代码来源:reactive-regist.component.ts

示例8: ngOnInit

 ngOnInit() {
     this.form = this.fb.group({
         'username': new FormControl('', [Validators.required, Validators.minLength(3)]),
         'password-group': new FormGroup(
             {
                 'password': new FormControl('', [Validators.required, Validators.minLength(6)]),
                 'confirm-password': new FormControl('')
             },
             (c: FormGroup) =>
                 c.value['password'] === c.value['confirm-password'] ?
                     null :
                 {'pass-confirm': true}
         )
     })
 }
开发者ID:royipressburger,项目名称:ng2-ui-auth-example,代码行数:15,代码来源:signup.component.ts

示例9: initAddressForm

 initAddressForm() {
   return this.fb.group({
     'first_name': ['', Validators.required],
     'last_name': ['', Validators.required],
     'address_line_2': ['', Validators.required],
     'address_line_1': ['', Validators.compose([Validators.required, Validators.minLength(10)])],
     'city': ['', Validators.required],
     'phone': ['', Validators.compose([
       Validators.required, Validators.minLength(10),
       Validators.maxLength(10), Validators.pattern('[0-9]{10}')])],
     'zip_code': ['', Validators.required],
     'state_id': ['', Validators.required],
     'country_id': ['', Validators.required]
   });
 }
开发者ID:TrietPham96,项目名称:angularspree,代码行数:15,代码来源:address.service.ts

示例10: createForm

 createForm() {
     this.loginForm = this.formBuilder.group({
         email: ['', Validators.compose([
             Validators.required,
             Validators.minLength(3),
             Validators.maxLength(30),
             this.validateEmail
         ])],
         password: ['', Validators.compose([
             Validators.required,
             Validators.minLength(8),
             Validators.maxLength(30),
             this.validatePassword
         ])]
     })
 }
开发者ID:The-Humdrum-Wolves,项目名称:The-Humdrum-Wolves,代码行数:16,代码来源:login.component.ts


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