Click here to Skip to main content
15,916,692 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have button to pass value to the database in typescript. I got error in my use.component.ts subscribe does not exist on type void. Here'my code
onSubmit(form: NgForm) {

insertRecord(form: NgForm) {
    this.service.postUser(form.value).subscribe(response => {

I tries to import 'Observable' from 'rxjs' and import 'rxjs/add/operator/map' but it didn't work. How to fix this?

What I have tried:

import { Observable } from 'rxjs';

import 'rxjs/add/operator/map';
Updated 23-Dec-22 2:12am
Richard MacCutchan 4-Nov-21 5:05am    
The message is telling you that the result of this.service.postUser(form.value) is a void reference. That is, the call to postUser failed.
amazing stream 9-Nov-21 0:27am    
thanks for the answer!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900