简体   繁体   English

为什么我不能从json文件中检索数据?

[英]Why can't I retrieve the data from my json file?

in order to learn AngularJS I'm doing a simple page for a company that will display products that will be read from a json file. 为了学习AngularJS,我正在为一家公司做一个简单的页面,该页面将显示将从json文件读取的产品。 I followed the tutorial on the angularjs website that did the same thing that I want to accomplish but when I do it by myself my browser tell me that I have two errors and I get this message SyntaxError: Unexpected token a at Object.parse (native) , I couldn't find the error anywhere. 我遵循了angularjs网站上的教程,该教程完成了我想完成的相同操作,但是当我自己执行此操作时,我的浏览器告诉我我有两个错误,并且我收到此消息SyntaxError: Unexpected token a at Object.parse (native) ,我在任何地方都找不到错误。

This is my link to my github profile , to the branch that I'm having trouble with. 这是我到github个人资料的链接,也是我遇到问题的分支的链接。 You can check out the js/app.js to see the controller which does the request and it will be displayed in the partials/products.html file. 您可以检出js/app.js来查看执行请求的控制器,该请求将显示在partials/products.html文件中。 Feel free to see the other files too, the services.js was something that I tried but couldn't make it to work and it isn't used in the project so you can ignore it. 也可以随意查看其他文件,我尝试了services.js ,但无法使其正常工作,并且在项目中未使用它,因此您可以忽略它。

Any ideas? 有任何想法吗?

您需要将第一个年龄字段用引号引起来:例如“年龄”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM