SyntaxError: Unexpected token e in JSON at position 1 at JSON.parse (<anonymous>)

SyntaxError: Unexpected token e in JSON at position 1 at JSON.parse (<anonymous>)

我想通过将 API 调用到 Angular 来获取字符串值。 这就是我在做什么 服务文件-

 public getRespondDashboardUrl(): Observable<any> {
    return this.http.get(`ref/RespondDashboardUrl`);
  }

组件文件

respondDashboardLink: string;
this.refService.getRespondDashboardUrl().subscribe(result => {
  this.respondDashboardLink = result;
});

函数returns URL作为字符串值https://abcd.xyz.com/Respond/App/index.html#ActionCenter/0

我收到错误

SyntaxError: Unexpected token h in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad (http://localhost:4000/vendor.js:33488:51) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4000/polyfills.js:8108:31) at Object.onInvokeTask (http://localhost:4000/vendor.js:78969:33) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4000/polyfills.js:8107:60) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:4000/polyfills.js:7880:47) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:4000/polyfills.js:8183:34) at invokeTask (http://localhost:4000/polyfills.js:9429:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:4000/polyfills.js:9466:21)

如果您的响应类型是字符串。更多类型检查 responseType.

this.http.get(`ref/RespondDashboardUrl`, {responseType: 'text'})