Ember无法读取未定义

时间:2015-10-02 09:28:58

标签: javascript ember.js ember-data

当我尝试从路径返回模型时出现以下错误

enter image description here

我的模特task.js

 //My Code for returning the model
      //My Model initialization :
        Taskmanagementfortenmiles.Task = DS.Model.extend({
          display_id: DS.attr('string'),
          type: DS.attr('string'),
          display_name: DS.attr('string'),
          isCompleted:DS.attr('boolean'),
          timestamp: DS.attr() 
        });

My Route task_route.js:

Taskmanagementfortenmiles.TaskRoute = Ember.Route.extend({

    model: function() {
     return $.getJSON("http://localhost:3000/tasks").then(function(response) {
                  var task = [];
                  var self = this;
                  response.forEach(function(task) {
                   console.log(self.store.createRecord('task', {
                        display_id: random_id,
                        type: type,
                        display_name: displayName,
                        isCompleted: false,
                        timestamp: date
                    }).save());
                }); 
                return task;
              });
  },
});

我的ember数据版本是我收到错误的问题吗?

请有人在这个问题上帮助我。

提前致谢

0 个答案:

没有答案