首页 > 解决方案 > 'Uncaught SyntaxError: Unexpected token %' 将 jsonp 与 angular5 一起使用时的问题

问题描述

我是 angular5 的新手,我尝试使用 'jsonp' 属性调用 api。

this.http.jsonp('http://localhost/angular5/lesson2.pdf?callback=JSONP_CALLBACK').subscribe(res=>{
     console.log(res);
   })

在上面的代码中,我使用'HttpClinetJsonpModule'来调用api。但它返回以下错误。 在此处输入图像描述 谁能帮我解决这个问题。我已经花了几个小时。

标签: angular5

解决方案


推荐阅读