當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。