@ismailcse11 wrote:
form validation from apche server using http
this.authForm = fb.group({
'email' : [null, Validators.compose([Validators.required, EmailExists.existsEmail ])]})email validator
export class EmailExists {
static existsEmail(fc: FormControl): ValidationResult } { let headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); let data='email='+fc.value; http.post('http://localhost/shirtmela/API/registration_email_check.php',data,{headers: headers}) .map(res => res.json()) .subscribe(data => { let posts = data.msg; if(posts=='success'){ return ({existsEmail: true}); }else{ return (null); } }, (err) => { return (null); }); }}
How can i solve this problem using static method. Thanks in advance.
Posts: 1
Participants: 1