本文整理汇总了TypeScript中@angular/common.Validators.compose方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.compose方法的具体用法?TypeScript Validators.compose怎么用?TypeScript Validators.compose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common.Validators
的用法示例。
在下文中一共展示了Validators.compose方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(builder: FormBuilder) {
this.user = new User('joe.satriani@gmail.com', 'secretpass');
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) => {
console.log('email', value);
});
this.password.valueChanges.subscribe((value: string) => {
console.log('password', value);
});
this.group.valueChanges.subscribe((value: any) => {
console.log('form', value);
});
}
示例2: constructor
constructor(
private authService: AuthService, private router: Router, private builder: FormBuilder) {
this.username =
new Control('', Validators.compose([Validators.required, Validators.minLength(4)]));
this.password = new Control('', Validators.compose([Validators.required]));
this.loginForm = builder.group({username: this.username, password: this.password});
}
示例3: ngOnInit
ngOnInit() {
this.name = new Control('',
Validators.compose([
Validators.required
]));
this.price = new Control('',
Validators.compose([
Validators.required
]));
this.description = new Control('',
Validators.compose([
Validators.required,
Validators.minLength(3),
Validators.maxLength(50)
]));
this.insertForm = this._fb.group({
'name': this.name,
'price': this.price,
'description': this.description
});
}
示例4: constructor
constructor(private auth: Auth,
private router: Router) {
this.loginForm = new ControlGroup({
email: new Control('user@example.com', Validators.compose([Validators.required])),
password: new Control('secret', Validators.compose([Validators.required]))
});
}
示例5: constructor
constructor(private eventService: EventService,
private builder: FormBuilder, private router: Router) {
this.name = new Control('', Validators.required);
this.date = new Control('', Validators.required);
this.time = new Control('', Validators.required);
this.price = new Control('', Validators.compose([Validators.required, Validators.pattern('\\d\+(\\.\\d{0,2})?')]));
this.address = new Control('', Validators.required);
this.city = new Control('', Validators.required);
this.country = new Control('', Validators.compose([Validators.required, Validators.pattern('[A-Z]{2}')]));
this.imageUrl = new Control('', Validators.required);
// this.country = new Control('', exactly2);
this.newEventForm = builder.group({
name: this.name,
date: this.date,
time: this.time,
price: this.price,
location: builder.group({
address: this.address,
city: this.city,
country: this.country
}),
imageUrl: this.imageUrl,
})
}
示例6: constructor
constructor(
private events: Events,
private nav: NavController,
private auth: AuthProvider,
private formBuilder: FormBuilder) {
this.name = new Control("", Validators.compose([
Validators.required,
Validators.minLength(6),
Validators.maxLength(64)
]));
this.email = new Control("", Validators.compose([
Validators.required,
Validators.pattern("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"),
Validators.minLength(6),
Validators.maxLength(64)
]));
this.password = new Control("", Validators.compose([
Validators.required,
Validators.minLength(6),
Validators.maxLength(24)
]));
this.registerForm = formBuilder.group({
"name": this.name,
"email": this.email,
"password": this.password
});
}
示例7: 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;
});
}
示例8: constructor
constructor(private _carservice:CarsService,fb:FormBuilder,private _router:Router){
this.registerForm = fb.group({
username:['',Validators.compose([Validators.required,Validators.minLength(5)])],
password:['',Validators.compose([Validators.required,Validators.minLength(5)])]
})
console.log(this.registerForm.controls);
}
示例9: constructor
constructor(private nav: NavController, private fb: FormBuilder, private userData: UserData) {
this.authForm = fb.group({
'email': ['', Validators.compose([Validators.required, CustomValidators.checkEmailValidator])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(6)])]
});
this.email = this.authForm.controls['email'];
this.password = this.authForm.controls['password'];
}
示例10: ngOnInit
ngOnInit() {
this.authForm = this.fb.group({
'username': ['', Validators.compose([Validators.required, Validators.minLength(3)])],
'password': ['', Validators.compose([Validators.required, Validators.minLength(3)])]
});
this.username = this.authForm.controls['username'];
this.password = this.authForm.controls['password'];
}