As you can see currently i send the form data as this.loginForm.value
now the thing is that I have too more properties planId
and service
that I want to send along with the data.
One way is that i recreate the object as below and send it but it is not convenient.
const userDetails = {
email: this.loginForm.controls.email.value,
password: this.loginForm.controls.password.value,
planId: this.planId,
service: this.service
}
…
export class LoginComponent
planId = "2";
service = "seo";
ngOnInit() {
this.loginForm = this.formBuilder.group({
email: ['', [Validators.required, Validators.email]],
password: ['', Validators.required]
})
onSubmit() {
this.auth.loginUser(this.loginForm.value).subsribe((res)=>{
........
})
}
2
Answers
May be you can try like this…
May be this will help