Online Grocery Shop
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.
 
 
 
 
 

38 lines
888 B

import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import { User } from 'src/app/models/user';
import { UserService } from 'src/app/services/user.service';
@Component({
selector: 'app-signup',
templateUrl: './signup.component.html',
styleUrls: ['./signup.component.css']
})
export class SignupComponent implements OnInit {
user :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 => { alert("Signup Successful")
})
// .subscribe(x => {alert("Sign up Successfull")});
}
constructor(private _userservice:UserService) {
this.user=new User();
this.isFormSubmitted=false;
}
ngOnInit(): void {
}
}