本文整理汇总了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
])]
})
}