此视图:
<input type="text" [(ngModel)]="id">
<br/>
<input type="text" [(ngModel)]="fname">
<br/>
<input type="text" [(ngModel)]="lname">
<br/>
开机自检
这是我的服务:
setpost(donner): Observable<Interfaces[]>
{
return this.http.put<Interfaces[]>(this.mylink, donner);
}
这是我的界面:
export interface Interfaces {
id:number;
fname:string;
lname:string;
}
这是我的本地JSON文件:
[
{
"id": 1,
"fname": "xxxx",
"lname": "___"
}
]
单击按钮将数据提交到本地文件时出现错误警报的问题
ERROR
Object { headers: {…}, status: 404, statusText: "Not Found", url: "http://localhost:4200/assets/data/posts.json", ok: false, name: "HttpErrorResponse", message: "Http failure response for http://localhost:4200/assets/data/posts.json: 404 Not Found", error: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot PUT /assets/data/posts.json</pre>\n</body>\n</html>\n" }