angular2 http.get返回错误404?
角ts码angular2 http.get返回错误404?,angular,Angular,角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') ); 但有一个错误: 您已将locat主机放在url中,而不是local主机 作为
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')
);
但有一个错误:
您已将locat主机放在url中,而不是local主机 作为此类问题的提示,如果您确认URL在浏览器中工作,请将其复制并粘贴到代码中,以确保您使用的内容与您确认的工作内容相同