本文整理汇总了TypeScript中angular2/common.Validators.minLength方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.minLength方法的具体用法?TypeScript Validators.minLength怎么用?TypeScript Validators.minLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/common.Validators
的用法示例。
在下文中一共展示了Validators.minLength方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(fb: FormBuilder) {
this.form = fb.group({
currentPassword: [
'',
Validators.compose([
Validators.required
]),
// Validators.composeAsync([
// PasswordValidators.shouldBeValid
// ])
],
newPassword: [
'',
Validators.compose([
Validators.required,
Validators.minLength(5)
])
],
newPassword1: [
'',
Validators.compose([
Validators.required,
Validators.minLength(5)
])
]
}, {validator: PasswordValidators.twoPasswordsShouldBeMatched})
}
示例2: 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
})
}
示例3: constructor
constructor(
formBuilder: FormBuilder,
private _notificationService: NotificationsService
) {
this.regForm = formBuilder.group({
'name': ['', Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(20), Validators.pattern('^[a-zA-Z ]+$')])],
'email': ['', Validators.compose([Validators.required, Validators.pattern('[0-9a-zA-Z_.-]+[@]+[a-zA-Z]+[.]+[a-zA-Z]{2,5}$')])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(1000), hasUpper, hasLower, hasDigit, hasSpecial])],
'employer': ['', Validators.pattern('^[a-zA-Z0-9 .]+$')],
'position': ['', Validators.pattern('^[a-zA-Z0-9 .]+$')],
'fruit': ['', Validators.pattern('^[a-zA-Z ]+$')],
'num': ['', Validators.pattern('^[0-9]+$')],
'year': ['', Validators.pattern('^([0-9]|[0-9][0-9]|[0-9][0-9][0-9]|[1][0-9][0-9][0-9]|[2][0][0][0-9]|[2][0][1][0-6])$')],
'throne': ['', Validators.pattern('^[a-zA-Z0-9!._-]+[@]+[a-zA-Z.]+$')],
});
this.reqChecks = [
{name: 'name', value: this.regForm.find('name').valid},
{name: 'email', value: this.regForm.find('email').valid},
{name: 'password', value: this.regForm.find('password').valid}
];
this.optChecks = [
{name: 'employer', value: this.regForm.find('employer').valid},
{name: 'position', value: this.regForm.find('position').valid},
{name: 'fruit', value: this.regForm.find('fruit').valid},
{name: 'num', value: this.regForm.find('num').valid},
{name: 'year', value: this.regForm.find('year').valid},
{name: 'throne', value: this.regForm.find('throne').valid}
]
}
示例4: constructor
constructor(private nav: NavController, fb: FormBuilder) {
this.loginForm = fb.group({
username: ["", Validators.required, Validators.minLength(4), this.checkFirstCharacterValidator],
password: ["", Validators.required, Validators.minLength(6), this.checkFirstCharacterValidator]
});
//console.log(this.loginForm.controls, this.loginForm, this.loginForm instanceof ControlGroup);
this.usernameCtrl = this.loginForm.controls['username'];
this.passwordCtrl = this.loginForm.controls['password'];
/**
* 监测form变化,ControlGroup和Control均可使用此方式
*/
this.loginForm.valueChanges.subscribe(form => {
console.log('form changes to ', form);
});
this.usernameCtrl.valueChanges.subscribe(value => {
console.log('username changes to ', value);
});
this.passwordCtrl.valueChanges.subscribe(value => {
console.log('password changes to ', value);
});
}
示例5: constructor
constructor(private fb: FormBuilder, private translate: TranslateService) {
this.translate = translate;
this.authForm = fb.group({
'username': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])]
});
this.username = this.authForm.controls['username'];
this.password = this.authForm.controls['password'];
}
示例6: constructor
constructor(public nav: NavController,
public fb: FormBuilder)
{
this.authForm = fb.group({
'username': ['', Validators.compose([Validators.required, Validators.minLength(8)])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(8)])]
});
this.username = this.authForm.controls['username'];
this.password = this.authForm.controls['password'];
}
示例7: constructor
constructor(private nav: NavController, private firebaseService: FirebaseService, fb: FormBuilder) {
this.minEmailLen = 4;
this.maxEmailLen = 30;
this.minPasswordLen = 6;
this.maxPasswordLen = 20;
this.submitButtonText = "Login";
this.isAuthOngoing = false;
this.authForm = fb.group({
'email' : ['', Validators.compose([Validators.required, Validators.minLength(this.minEmailLen), Validators.maxLength(this.maxEmailLen)])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(this.minPasswordLen), Validators.maxLength(this.maxPasswordLen)])]
});
this.email = this.authForm.controls['email'];
this.password = this.authForm.controls['password'];
}
示例8: constructor
constructor(builder: FormBuilder) {
this.email = new Control('',
Validators.compose([Validators.required, CustomValidators.emailFormat]),
CustomValidators.duplicated
);
this.password = new Control('',
Validators.compose([Validators.required, Validators.minLength(4)])
);
this.group = builder.group({
email: this.email,
password: this.password
});
this.email.valueChanges.subscribe((value: string) => {
this.emailValue = value;
});
this.password.valueChanges.subscribe((value: string) => {
this.passwordValue =value;
});
this.group.valueChanges.subscribe((value: any) => {
this.groupValue = value;
});
}
示例9: get
static get(): Control {
return new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
PhoneValidator.mailFormat
]));
}
示例10: constructor
constructor(private _authService: AuthService, fb: FormBuilder) {
this.registerForm = fb.group({
email: ['', Validators.required],
password: ['', Validators.compose([Validators.required, Validators.minLength(8)])],
password_confirmation: ['', Validators.compose([Validators.required, Validators.minLength(8)])]
}, {validator: this.matchingPasswords('password', 'password_confirmation')});
}