Reputation: 341
The below TypeScript code in Angular 12 is giving me error when I run the server. Help
const {email, password} from f.form.value;
//TODO: do your checking here
this.auth.signUp(email, password)
.then((res) =>{
this.router.navigateByUrl('/');
this.toastr.success("Signup Success")
})
.catch((err) => {
console.log(err.message);
this.toastr.error("Signup failed")
})
}```
Upvotes: 1
Views: 128
Reputation: 341
const { email, password } = f.form.value;
//TODO: do your checking here
this.auth.signUp(email,password)
.then((res) =>{
this.router.navigateByUrl('/');
this.toastr.success("Signup Success")
})
.catch((err) => {
console.log(err.message);
this.toastr.error("Signup failed")
})
}
Upvotes: 0
Reputation: 581
You can try this:
form : FormGroup = new FormGroup({
email: new FormControl(),
password: new FormControl()
})
In your HTML, you can bind it to the input like this:
<input matInput formControlName="email">
<input matInput formControlName="password">
Then access it using:
this.form.get('email').value
this.form.get('password').value
Upvotes: 2