繁体   English   中英

angular2 http.get返回错误404?

[英]angular2 http.get returns an error 404?

本地服务器api:http:// localhost:8000 / heroes.json

角度ts码

 this.http.get('http://localhost:8000/heroes.json')
.map(res => res.text())
.subscribe(
data => this.randomQuote = data,
err => this.logError(err),
() => console.log('Random Quote Complete')
);

但出现错误:

404错误

你已经把LOCA 牛逼主机的网址,而不是LOCA 主机。

作为此类问题的提示,如果您确认URL在浏览器中可以正常工作,请将其复制并粘贴到代码中,以确保所使用的内容与确认的内容相同。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM