を起動しませんでした:// 3000 NPMサーバーに角度2 JSONP注入されたスクリプトは、私がローカルホスト上でアプリケーションを実行していたコールバックエラー
Servicesファイル:
import {Injectable} from "@angular/core";
import {Jsonp} from "@angular/http";
import 'rxjs/add/operator/map';
@Injectable()
export class futScoreService{
constructor(private _jsonp:Jsonp){}
getCompetitions(){
let queryString ='?callback=JSONP_CALLBACK';
return this._jsonp.get('http://api.football-data.org/v1/competitions/' + queryString,{method: 'Get'})
.map((res) => res.json());
}
}
コンポーネントファイル:
ngOnInit(){
this._futScoreService.getCompetitions().subscribe(
(comp)=>{
console.log(comp);
},
(err)=>{
console.log(err);
}
);
}
コンソールでこのエラーが発生していますconsole-error とネットワークタブでは、私はAPIからオブジェクトを取得しますnetwork-tab