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