本文整理汇总了TypeScript中@angular/forms.Validators.maxLength方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.maxLength方法的具体用法?TypeScript Validators.maxLength怎么用?TypeScript Validators.maxLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.Validators
的用法示例。
在下文中一共展示了Validators.maxLength方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getItemForm
/**
* Return the item form with default values and form controls.
*/
getItemForm(): FormGroup {
this.isDataType = this.partyType.getObjectName() === 'siteDataCenters'
|| this.partyType.getObjectName() === 'siteDataSource';
this.isMetadataCustodian = this.partyType.getObjectName() === 'siteMetadataCustodian';
this.isDataCenter = this.partyType.getObjectName() === 'siteDataCenters';
let individualNameValidators: any[] = !this.isDataType ? [Validators.required] : [];
individualNameValidators.push(Validators.maxLength(200));
let organisationValidators: any[] = (this.isDataType || this.isMetadataCustodian) ? [Validators.required] : [];
organisationValidators.push(Validators.maxLength(200));
return this.formBuilder.group({
id: [null],
individualName: ['', individualNameValidators],
organisationName: ['', organisationValidators],
positionName: ['', [Validators.maxLength(100)]],
deliveryPoint: ['', [Validators.maxLength(2000)]],
city: ['', [Validators.maxLength(100)]],
administrativeArea: ['', [Validators.maxLength(100)]],
postalCode: ['', [Validators.maxLength(25)]],
country: [''],
email: [''],
primaryPhone: ['', [Validators.maxLength(25)]],
secondaryPhone: ['', [Validators.maxLength(25)]],
fax: ['', [Validators.maxLength(25)]],
url: [''],
});
}
示例2: constructor
constructor(
private formBuilder: FormBuilder,
private storeService: StoreService,
private router: Router) {
this.form = formBuilder.group({
'name': ['', [Validators.minLength(2), Validators.maxLength(20)]],
'description': ['',[Validators.minLength(4), Validators.maxLength(255)]]
});
}
示例3: getItemForm
/**
* Return the item form with default values and form controls.
*/
getItemForm(): FormGroup {
return this.formBuilder.group({
id: [null],
instrumentationType: ['', [Validators.required]],
status: ['', [Validators.maxLength(2000)]],
startDate: [''],
endDate: [''],
notes: ['', [Validators.maxLength(2000)]],
});
}
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:13,代码来源:collocation-information-item.component.ts
示例4: getItemForm
/**
* Return the item form with default values and form controls.
*/
getItemForm(): FormGroup {
return this.formBuilder.group({
id: [null],
possibleProblemSource: ['', [Validators.maxLength(100)]],
startDate: [''],
endDate: [''],
notes: ['', [Validators.maxLength(2000)]],
objectMap: [''],
});
}
示例5: getItemForm
/**
* Return the item form with default values and form controls.
*/
getItemForm(): FormGroup {
return this.formBuilder.group({
id: [null],
standardType: ['', [Validators.maxLength(200)]],
inputFrequency: ['', [Validators.maxLength(25)]],
startDate: [''],
endDate: [''],
notes: ['', [Validators.maxLength(2000)]],
objectMap: [''],
});
}
示例6: 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)
});
}
示例7: ngOnInit
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void
{
// Reactive Form
this.form = this._formBuilder.group({
company : [
{
value : 'Google',
disabled: true
}, Validators.required
],
firstName : ['', Validators.required],
lastName : ['', Validators.required],
address : ['', Validators.required],
address2 : ['', Validators.required],
city : ['', Validators.required],
state : ['', Validators.required],
postalCode: ['', [Validators.required, Validators.maxLength(5)]],
country : ['', Validators.required]
});
// Horizontal Stepper form steps
this.horizontalStepperStep1 = this._formBuilder.group({
firstName: ['', Validators.required],
lastName : ['', Validators.required]
});
this.horizontalStepperStep2 = this._formBuilder.group({
address: ['', Validators.required]
});
this.horizontalStepperStep3 = this._formBuilder.group({
city : ['', Validators.required],
state : ['', Validators.required],
postalCode: ['', [Validators.required, Validators.maxLength(5)]]
});
// Vertical Stepper form stepper
this.verticalStepperStep1 = this._formBuilder.group({
firstName: ['', Validators.required],
lastName : ['', Validators.required]
});
this.verticalStepperStep2 = this._formBuilder.group({
address: ['', Validators.required]
});
this.verticalStepperStep3 = this._formBuilder.group({
city : ['', Validators.required],
state : ['', Validators.required],
postalCode: ['', [Validators.required, Validators.maxLength(5)]]
});
}
示例8: 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
})
}
示例9: createForm
createForm() {
this.form = this.formBuilder.group({
email: [this.authService.user.email, Validators.compose([
Validators.required,
Validators.maxLength(40),
this.validateEmail
])],
name: [this.authService.user.name, Validators.compose([
Validators.required,
Validators.minLength(1),
Validators.maxLength(30)
])],
});
}
示例10: getItemForm
/**
* Return the item form with default values and form controls.
*/
getItemForm(): FormGroup {
return this.formBuilder.group({
id: [null],
type: ['', [Validators.required, Validators.maxLength(100)]],
manufacturer: ['', [Validators.required, Validators.maxLength(100)]],
serialNumber: ['', [Validators.maxLength(100)]],
heightDiffToAntenna: [''],
calibrationDate: [''],
startDate: [''],
endDate: [''],
notes: [['', [Validators.maxLength(2000)]]],
objectMap: [''],
});
}