【问题标题】:I got a Error during my Todos project : Http failure response for http://localhost:4200/ :404 Not Found我在 Todos 项目期间遇到错误:http://localhost:4200/:404 Not Found 的 Http 失败响应
【发布时间】:2019-03-05 19:42:38
【问题描述】:

运行删除部分时出现错误: http://localhost:4200/$%7Bthis.todosUrl%7D/$%7Btodo.id%7D 的 Http 失败响应:404 Not Found

【问题讨论】:

  • 请出示代码。
  • 你是如何导航的?您似乎在不需要 { } 的地方使用它。

标签: angular typescript


【解决方案1】:

我猜你在做什么:

'http://localhost:4200/{{this.todosUrl}}/{{todo.id}}'

或者

'http://localhost:4200/${this.todosUrl}/${todo.id}'

尝试更改为:

`http://localhost:4200/${this.todosUrl}/${todo.id}`

【讨论】:

  • 或使用router.navigaterouterLink?
  • @UmutEsen 不清楚 OP 是在导航还是在发出 API 请求.. :/
  • 在运行时,Url中的部分工作正常。但是添加的源文件不起作用。
猜你喜欢
  • 2018-10-27
  • 1970-01-01
  • 2017-01-12
  • 1970-01-01
  • 1970-01-01
  • 2018-11-15
  • 2017-01-20
  • 2019-01-13
  • 1970-01-01
相关资源
最近更新 更多