export class EditClientComponent implements OnInit {
apiEndPoint: 'http://localhost:1337/upload';
fileChange(event) {
//...
this.http.post(`${this.apiEndPoint}`, formData, httpOptions)
//...
}
}
Run Code Online (Sandbox Code Playgroud)
我得到一个奇怪的错误:
status: 404, statusText: "Not Found", url: "http://localhost:4100/undefined"...
这意味着,它不读apiEndPoint 所有,如果我取代${this.apiEndPoint}与实际的URL,它的工作原理.
我能做什么?
将apiEndPoint的声明更改为=而不是:
apiEndPoint = 'http://localhost:1337/upload';
Run Code Online (Sandbox Code Playgroud)
您指定的变量类型不是初始值.
| 归档时间: |
|
| 查看次数: |
285 次 |
| 最近记录: |