本文整理匯總了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: [""]
});
}
示例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)]]
});
}
示例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)
});
}
示例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)],
});
}
示例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;
}
示例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
})
}
示例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
}),
});
}
示例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}
)
})
}
示例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]
});
}
示例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
])]
})
}