本文整理汇总了TypeScript中@angular/forms.Validators.compose方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.compose方法的具体用法?TypeScript Validators.compose怎么用?TypeScript Validators.compose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.Validators
的用法示例。
在下文中一共展示了Validators.compose方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(
public navCtrl: NavController ,
private _services: GlobalServices ,
private _fb: FormBuilder ,
private _loader: LoaderUtil,
private _alert: AlertUtil,
private _storage: StorageUtil,
private _store: StoreUtil,
private _userAction : UserAction,
private _zone: NgZone,
private _push: Push
) {
this.EMAIL_REGEXP = "^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$"
this.registerForm = this._fb.group({
name: ['' , Validators.compose([Validators.required , Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*')])],
email: ['' , Validators.compose(
[
Validators.required ,
Validators.pattern(this.EMAIL_REGEXP)
])
]
})
this.registerSuccess = false
this.submitAttempt = false
this.tryToAuth = true
}
示例2: constructor
constructor(private formBuilder: FormBuilder) {
this.hireMe = this.formBuilder.group({
'sender': new FormControl('', Validators.compose([Validators.required])),
'sendermail': new FormControl('', Validators.compose([Validators.required])),
'subject': new FormControl('', Validators.compose([Validators.required])),
});
}
示例3: constructor
constructor(private nav: NavController, private us: UserService, private events: Events, private fs: FirebaseService, toastCtrl: ToastController) {
super(toastCtrl);
this.user = UserService.getCurrentUser();
if (this.user == null) {
this.user = new User(null, null, null);
this.user.photoURL = fs.auth.currentUser.photoURL;
this.user.mail = fs.auth.currentUser.email;
this.user.displayName = fs.auth.currentUser.displayName;
}
LogService.logMessage("ProfilePage constructor ", this.user);
this.form = new FormGroup({
mail: new FormControl(this.user.mail, Validators.compose([ValidationService.emailValidator])),
displayName: new FormControl(this.user.displayName, Validators.compose([Validators.required, Validators.minLength(8)])),
auto: new FormControl(this.user.auto),
auto2: new FormControl(this.user.auto2),
houseNumber: new FormControl(this.user.houseNumber),
flatNumber: new FormControl(this.user.flatNumber, Validators.compose([Validators.required, ValidationService.digitalValidator])),
mobile1: new FormControl(this.user.mobile1, Validators.compose([Validators.required, Validators.minLength(8)])),
mobile2: new FormControl(this.user.mobile2),
photoURL: new FormControl(this.user.photoURL)
});
this.displayName = this.form.controls['displayName'];
this.auto = this.form.controls['auto'];
this.auto2 = this.form.controls['auto2'];
this.houseNumber = this.form.controls['houseNumber'];
this.flatNumber = this.form.controls['flatNumber'];
this.mail = this.form.controls['mail'];
this.mobile1 = this.form.controls['mobile1'];
this.mobile2 = this.form.controls['mobile2'];
this.photoURL = this.form.controls['photoURL'];
}
示例4: createValidators
/**
* Creates form validationdepending [ITdDynamicElementConfig] properties.
*/
createValidators(config: ITdDynamicElementConfig): ValidatorFn {
let validator: ValidatorFn;
if (config.required) {
validator = Validators.required;
}
if (config.max || config.max === 0) {
validator = Validators.compose([validator, Validators.max(parseFloat(config.max))]);
}
if (config.min || config.min === 0) {
validator = Validators.compose([validator, Validators.min(parseFloat(config.min))]);
}
if (config.maxLength || config.maxLength === 0) {
validator = Validators.compose([validator, Validators.maxLength(parseFloat(config.maxLength))]);
}
if (config.minLength || config.minLength === 0) {
validator = Validators.compose([validator, Validators.minLength(parseFloat(config.minLength))]);
}
// Add provided custom validators to the validator function
if (config.validators) {
config.validators.forEach((validatorConfig: ITdDynamicElementValidator) => {
validator = Validators.compose([validator, validatorConfig.validator]);
});
}
return validator;
}
示例5: getMetricAvailableActions
//Metric Available Acions:
getMetricAvailableActions (data ? : any) : any {
let tableAvailableActions = [
//Remove Action
{'title': 'Remove', 'content' :
{'type' : 'button','action' : 'RemoveAllSelected'}
},
//Change Property Action
{'title': 'Change property', 'content' :
{'type' : 'selector', 'action' : 'ChangeProperty', 'options' : [
{'title' : 'DataSrcType', 'type':'boolean', 'options' : [
'INTEGER','Integer32','Gauge32','UInteger32','Unsigned32','Counter32','Counter64','TimeTicks','BITS','ENUM','OCTETSTRING','OID','IpAddress','TIMETICKS','COUNTER32','COUNTER64','COUNTERXX','HWADDR','STRINGPARSER','STRINGEVAL','CONDITIONEVAL','BITSCHK'
]
},
{'title': 'Scale','type':'input', 'options':
new FormGroup({
formControl : new FormControl('', Validators.compose([Validators.required,ValidationService.floatValidator]))
})
},
{'title': 'Shift','type':'input', 'options':
new FormGroup({
formControl : new FormControl('', Validators.compose([Validators.required,ValidationService.floatValidator]))
})
},
{'title' : 'IsTag', 'type':'boolean', 'options' : [
'true','false'
]
}
]},
}
];
return tableAvailableActions;
}
示例6: constructor
constructor(
public formBuilder: FormBuilder,
public navParams: NavParams,
private apiProvider: ApiProvider,
private logger: Logger,
private priceProvider: PriceProvider,
private currencyProvider: CurrencyProvider
) {
const chain: string = navParams.get('chain');
const network: string = navParams.get('network');
this.chainNetwork = {
chain,
network
};
this.apiProvider.changeNetwork(this.chainNetwork);
this.currencyProvider.setCurrency(this.chainNetwork);
this.priceProvider.setCurrency();
this.messageForm = formBuilder.group({
address: [
'',
Validators.compose([Validators.minLength(1), Validators.required])
],
signature: [
'',
Validators.compose([Validators.minLength(1), Validators.required])
],
message: [
'',
Validators.compose([Validators.minLength(1), Validators.required])
]
});
}
示例7: constructor
constructor(
private navCtrl: NavController,
private navParams: NavParams,
private events: Events,
private ab: AddressBookProvider,
private addressProvider: AddressProvider,
private formBuilder: FormBuilder,
private logger: Logger,
private popupProvider: PopupProvider
) {
this.addressBookAdd = this.formBuilder.group({
name: [
'',
Validators.compose([Validators.minLength(1), Validators.required])
],
email: ['', this.emailOrEmpty],
address: [
'',
Validators.compose([
Validators.required,
new AddressValidator(this.addressProvider).isValid
])
]
});
if (this.navParams.data.addressbookEntry) {
this.addressBookAdd.controls['address'].setValue(
this.navParams.data.addressbookEntry
);
}
this.events.subscribe('update:address', data => {
this.addressBookAdd.controls['address'].setValue(
this.parseAddress(data.value)
);
});
}
示例8: constructor
constructor(private fb : FormBuilder) {
this.form = this.fb.group({
oldPassword: ['', Validators.compose([Validators.required])],
newPassword:['', Validators.compose([Validators.required, PasswordValidator.checkPasswordLength])],
confirmPassword: ['', Validators.compose([Validators.required])]
});
}
示例9: ngOnInit
ngOnInit(): void {
this.userLoginFormGroup = this.formBuilder.group({
email: ['', Validators.compose([Validators.required])],
telephone: ['', Validators.compose([Validators.required])],
password: ['', Validators.compose([Validators.required,Validators.minLength(7)])],
confirmPassword:['', Validators.compose([Validators.required])]
})
}
示例10: ngOnInit
ngOnInit() {
this.loginForm = this.formBuilder.group({
'username': ['user2@site.com', Validators.compose([Validators.required])],
'password': ['123456', Validators.compose([Validators.required])]
});
this.validation.formGroup = this.loginForm;
}