1
ブラウザに貼り付けるURLがあるので、有効なjson応答が得られます。さて、私はlocalhostから、角度-cliの中から私がサービスから同じJSONを取得しようとしていると私はこれを取得:解決方法「Access-Control-Allow-Origin」ヘッダーは、angular-cliで書かれたangular 2サービスの要求されたリソース上に存在しませんか?
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 403
私はこの問題について読み込もうとしましたが、どのような私を理解していませんでした私のサービスを働かせるために行う必要があります。私は、角度cliを使用しています。
this.http.get(this.myUrl)
.map(res => res.text())
.subscribe(
data => this.jsonResult = data,
err => this.handleError(err),
() => console.log('Random Quote Complete')
);
これは私が得るエラーを返します。