本文整理汇总了TypeScript中angular2/common.Validators.maxLength方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.maxLength方法的具体用法?TypeScript Validators.maxLength怎么用?TypeScript Validators.maxLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/common.Validators
的用法示例。
在下文中一共展示了Validators.maxLength方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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
})
}
示例2: _applyValidators
private _applyValidators() {
this.form = this._formBuilder.group({
email: [this.model.email, Validators.compose([
Validators.required,
Validators.maxLength(255),
CtValidators.email,
])],
password: [this.model.password, Validators.compose([
Validators.required,
Validators.minLength(6),
Validators.maxLength(255),
])],
})
}
示例3: get
static get(): Control {
return new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
Validators.maxLength(30)
]));
}
示例4: initValidators
private initValidators():void {
console.log('Adding validators to control ',this.name);
let validators:Array<Function> = [];
if(this.required) {
validators.push(Validators.required);
}
if(this.isTypeText() && this.minLength) {
console.log('Adding minLength validator',this.minLength);
validators.push(Validators.minLength(this.minLength));
}
if(this.isTypeText() && this.maxLength) {
console.log('Adding maxLength validator',this.maxLength);
validators.push(Validators.maxLength(this.maxLength));
}
if(this.isTypeEmail()) {
validators.push(ValidatorService.emailValidator);
}
if(this.isTypeNumber()) {
validators.push(ValidatorService.numberValidator);
}
if(this.isInput() && this.pattern) {
validators.push(ValidatorService.regexValidator(this.pattern));
}
console.log(validators.length+' validators added to control',this.name);
this.validators = Validators.compose(validators);
}
示例5: constructor
constructor(fb: FormBuilder) {
this.projectForm = fb.group({
'clientName': ['', Validators.required],
'description': ['Nuclear Missile Defense System', Validators.compose([
Validators.required,
Validators.maxLength(30)
])],
'clientEmail': ['', Validators.compose([
MdPatternValidator.inline('^.+@.+\..+$'),
Validators.required,
Validators.minLength(10),
Validators.maxLength(100)
])],
'rate': [500, Validators.compose([
MdNumberRequiredValidator.inline(),
MdPatternValidator.inline('^1234$'),
MdMinValueValidator.inline(800),
MdMaxValueValidator.inline(4999)
])]
});
}
示例6: constructor
constructor(private _verify:VerifyService,
private _router:Router,
private _formBuilder:FormBuilder) {
this.token = new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
Validators.maxLength(8)
]));
this.verifyEmailForm = _formBuilder.group({
token: this.token
})
}
示例7: constructor
constructor(private userService : UserService,
private fb: FormBuilder,
private nav: NavController,
private navParams: NavParams) {
// If we navigated to this page, we will have an item available as a nav param
this.nav = nav;
this.smsverifycode =
new Control("",Validators.compose([Validators.required, Validators.maxLength(4), Validators.minLength(4)]));
this.form = fb.group({
smsverifycode: this.smsverifycode
});
}
示例8: constructor
constructor(
fb: FormBuilder,
public authService: AuthService,
public nav: NavController) {
this.signinForm = fb.group({
'email': ['', Validators.compose([
Validators.minLength(3),
Validators.maxLength(30),
Validators.required,
emailValidator
])],
'password': ['', Validators.required]
})
this.email = this.signinForm.controls['email']
this.password = this.signinForm.controls['password']
}
示例9: constructor
constructor(private _router:Router,
private _loginService:LoginService,
private _formBuilder:FormBuilder) {
this.email = new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
FormValidationService.isEmail
]));
this.password = new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
Validators.maxLength(30),
FormValidationService.isPassword
]));
this.loginForm = _formBuilder.group({
email: this.email,
password: this.password
});
}
示例10: constructor
constructor(public nav: NavController, public fb: FormBuilder) {
this.recipeForm = fb.group({
"name": ["", Validators.compose([Validators.required, Validators.minLength(3)])],
"description": ["", Validators.compose([Validators.required, Validators.maxLength(140)])],
"prepTime": ["", Validators.compose([Validators.pattern("^[0-9]*$")])],
"cookingTime": ["", Validators.compose([Validators.required, Validators.pattern("^[0-9]*$")])],
"ingredient1": ["", Validators.compose([Validators.required])],
"direction1": ["", Validators.compose([Validators.required])]
});
this.ingredients = [];
this.name = this.recipeForm.controls["name"];
this.description = this.recipeForm.controls["description"];
this.prepTime = this.recipeForm.controls["prepTime"];
this.cookingTime = this.recipeForm.controls["cookingTime"];
this.ingredients = [
this.recipeForm.controls["ingredient1"]
];
this.directions = [
this.recipeForm.controls["direction1"]
];
}