Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 正在加载带有余烬数据的.JSON文件_Javascript_Json_Ember.js_Ember Data - Fatal编程技术网

Javascript 正在加载带有余烬数据的.JSON文件

Javascript 正在加载带有余烬数据的.JSON文件,javascript,json,ember.js,ember-data,Javascript,Json,Ember.js,Ember Data,我想从我的文件夹中找到的komentari.json文件加载数据,当我插入新的内容时,数据会发生变化,它并不总是只有一条注释。当我尝试启动我的应用程序时,它没有显示任何内容。这是我的代码 app.js App = Ember.Application.create(); App.Router.map(function() { }); App.IndexRoute = Ember.Route.extend({ model: function() { return this.get('store')

我想从我的文件夹中找到的komentari.json文件加载数据,当我插入新的内容时,数据会发生变化,它并不总是只有一条注释。当我尝试启动我的应用程序时,它没有显示任何内容。这是我的代码

app.js

App = Ember.Application.create();
App.Router.map(function() {
});

App.IndexRoute = Ember.Route.extend({
model: function() {
return this.get('store').find('comment');
}
});

App.ApplicationAdapter = DS.RESTAdapter.extend({
namespace: "http://localhost/proba/",
url: "komentari.json"
});

App.Comment = DS.Model.extend({
name: DS.attr('string'),
comment: DS.attr('string')

});
索引页

<script type="text/x-handlebars" id="index">
<ul>
{{#each item in model}}
  <li>{{item.name}}</li>
 <li>{{item.comment}}</li>
{{/each}}
</ul>

您尚未定义任何映射。 尝试应用这里写的内容

{"comments":[{"name":"Name1",
             "comment":"Comment1"}]}