You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
974 B

import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import { Observable } from 'rxjs';
import { User } from 'src/app/models/user';
import { UserService } from 'src/app/services/user.service';
@Component({
selector: 'app-sign-up',
templateUrl: './sign-up.component.html',
styleUrls: ['./sign-up.component.css'],
})
export class SignUpComponent implements OnInit {
user: User;
tys: string = 't';
temp: Observable<User>;
isFormSubmitted: boolean;
public signup(signupForm: NgForm) {
if (signupForm.invalid) {
alert('Kindly enter all details');
return;
}
this.isFormSubmitted = true;
this._userservice.addUser(this.user).subscribe((x) => {
this.tys = 'y';
alert('Signup Successful');
if (this.tys == 't') alert('not');
});
}
constructor(private _userservice: UserService) {
this.user = new User();
this.isFormSubmitted = false;
}
ngOnInit(): void {}
}