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

时间:2022-11-26 05:55:25

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. 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,我正在为一家公司做一个简单的页面,该公司将展示将从json文件中读取的产品。我按照angularjs网站上的教程完成了我想要完成的同样的事情但是当我自己做的时候我的浏览器告诉我我有两个错误并且我收到此消息SyntaxError:Object.parse上的意外令牌a(原生的) ),我无法在任何地方找到错误。

This is my link to my github profile, to the branch that I'm having trouble with. 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. 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.

这是我链接到我的github配置文件,到我遇到问题的分支。您可以查看js / app.js以查看执行请求的控制器,它将显示在partials / products.html文件中。随意看到其他文件,services.js是我尝试但无法使其工作的东西,它没有在项目中使用,所以你可以忽略它。

Any ideas?

有任何想法吗?

1 个解决方案

#1


2  

you need to wrap the first age field in quotes: e.g. "age"

你需要用引号包装第一个年龄字段:例如“年龄”

#1


2  

you need to wrap the first age field in quotes: e.g. "age"

你需要用引号包装第一个年龄字段:例如“年龄”