从angular

时间:2018-11-25 12:53:45

标签: angular

我尝试从Json File加载数据时遇到以下错误:

StackBlitz的网址:: https://stackblitz.com/edit/angular-w5ynp7

  
    

ERROR错误:未捕获(承诺):HttpErrorResponse:     {“ headers”:{“ normalizedNames”:[],“ lazyUpdate”:null},“ status”:200,“ statusText”:“ OK”,“ url”:“ https://angular-w5ynp7.stackblitz.io/app/T

  
     

reeTable / data.json“,” ok“:false,” name“:” HttpErrorResponse“,” message“:” Http   解析期间失败   https://angular-w5ynp7.stackblitz.io/app/TreeTable/data.json“,”错误“:{”错误“:{},”文本“:” \ n \ n \ n https://fonts.googleapis.com/css?family=Source+Code+Pro: 400,700 |拉丁美洲:400,700,900 \“   rel = \“ stylesheet \”> \ n \ n \ n https://c.staticblitz.com/assets/preview-8222014a50f8588c56d057621cdaf871.css \“   /> \ n https://c.staticblitz.com/assets/common-209bfed278c493d9677aa.js \“   crossorigin = \“ anonymous \”> \ n https://c.staticblitz.com/assets/ext-08c1b71abc0bf1dd4138a.js \“   crossorigin = \“ anonymous \”> \ n https://c.staticblitz.com/d/webcontainer.242365d931bb8c63e4a.js \“   crossorigin = \“ anonymous \”> \ n https://c.staticblitz.com/assets/preview-c35b6c3f1aa2eeeddb9ba.js \“ crossorigin = \” anonymous \“> \ n   (function(){_ preboot(\“ https://l.staticblitz.com/b/v1/angular-w5ynp7/166a3be1edf \”,{p:\“ stackblitz \”,a:\“ AIzaSyBZSvuCzbUhuRrSpr-HjM5bFClLPaFF9Vg \”,o:true})}))()\ n \ n \ n \ n“}}       在resolvePromise(zone.js:814)       在resolvePromise(zone.js:771)       在评估时(zone.js:873)       在ZoneDelegate.invokeTask(zone.js:421)       在Object.onInvokeTask(ng_zone.ts:262)       在ZoneDelegate.invokeTask(zone.js:420)       在Zone.runTask(zone.js:188)       在rainMicroTaskQueue(zone.js:595)       在ZoneTask.invokeTask上[在调用时](zone.js:500)       在invokeTask(zone.js:1540)

请让我知道我要去哪里了。

1 个答案:

答案 0 :(得分:1)

无法从放置它们的目录中提供JSON文件。它们必须位于data下,其URL将为src/assets

Demo