尝试订阅该响应时出现以下错误。 (如何处理响应)(无法加载资源:服务器响应状态为406(不可接受))
student.component.ts //组件文件
respData:number; //declared respData as a number type
addNewStudent(){ //function calling from html page to send data to
//service.ts
this.studentService.addNewStudentTest(this.newStudentForm.value).subscribe(
data=>{
this.respData=data;
console.log(this.respData);
},err => {
console.log("Error occured.")
});
}
student.service.ts
addNewStudentTest(student):Observable<Number>{
return this.httpC.post<Number>(url, student);
}