Hi I am working on a angular web api project and I am getting this error on subscribe keyword, also imported observable but error is same. So if anyone has encounter this before kindly help.
employee.component.ts
import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import { EmployeeService } from 'src/app/shared/employee.service';
import 'rxjs/add/operator/maps';
import { Observable } from 'rxjs';
@Component({
selector: 'app-employee',
templateUrl: './employee.component.html',
styleUrls: ['./employee.component.css']
})
export class EmployeeComponent implements OnInit {
constructor(public service: EmployeeService) { }
ngOnInit(): void {
this.resetForm();
}
resetForm(form?: NgForm) {
if (form != null)
form.resetForm();
this.service.formData = {
EmployeeID: null,
FullName: '',
Position: '',
EMPCode: '',
Mobile: ''
}
}
onSubmit(form: NgForm) {
if (form.value.EmployeeID == null)
this.insertRecord(form);
}
insertRecord(form: NgForm) {
this.service.postEmployee(form.value).subscribe(res => {
this.resetForm(form);
});
}
}