在Angular 9中-如何获取没有回调函数的JSONP?

问题描述

我正在尝试获取以下URL的数据:

http://storage.googleapis.com/nacleanopenworldprodshards/Nations_cleanopenworldprodeu1.json

我正在使用Angular 9,这是我的service.ts:

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';



@Injectable({
  providedIn: 'root'
})
export class NationsService {

  constructor(private http: HttpClient) { }

  getData() {
    const url = 'http://storage.googleapis.com/nacleanopenworldprodshards/Nations_cleanopenworldprodeu1.json';

    return this.http.jsonp(url,'callback');
  }

}

很简单,对吧?但这不起作用。因为“ API”没有回调函数。我在stackoverflow中进行了大量搜索,但没有找到解决方法

有人知道使用Angular 9获取数据的方法吗?

非常感谢您!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)