Ember"转型中止"

sam*_*sam 7 javascript ember.js ember-data

我在我的Ember App Kit项目中有一条从REST服务获取的路由.这是代码:

var PatientsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, {
  model: function() {
    return this.store.find('patient').then(function(res) {
      console.log("success");
      return res;
    }, function() {
      console.log("error", arguments);
    });
  }
});

export default PatientsIndexRoute;
Run Code Online (Sandbox Code Playgroud)

但是当我导航到路线时(/patients/index在这种情况下),页面似乎什么都不做.这是控制台:

23:09:46.946 OPTIONS http://localhost:7000/patients/ [HTTP/1.0 200 OK 1ms]
23:09:46.881 "Attempting transition to patients.index" ember.js:3450
23:09:46.883 "Transition #3: patients.index: calling beforeModel hook" ember.js:3450
23:09:46.883 "Transition #3: patients.index: calling deserialize hook" ember.js:3450
23:09:46.948 GET http://localhost:7000/patients/ [HTTP/1.0 200 OK 4ms]
23:09:46.911 "success" app.js:171
23:09:46.912 "Transition #3: patients.index: calling afterModel hook" ember.js:3450
23:09:46.912 "Transition #3: Resolved all models on destination route; finalizing transition." ember.js:3450
23:09:46.915 "generated -> controller:patients.index" [object Object] ember.js:3450
23:09:46.918 "Transition #3: patients.index: transition was aborted" ember.js:3450
Run Code Online (Sandbox Code Playgroud)

通知transition was aborted:这是示出无论何时过渡被中止,但我无法确定通用消息,其中所述过渡被中止.我不认为它在获取模型时被中止,但是在一段时间之后afterModel或者setupController.

有趣的是,如果我删除该model功能,它将导航到该路线.也很奇怪:它渲染包装模板templates/patients.hbs而不是templates/patients/index.hbs模板.

编辑1:这是路由器:

var Router = Ember.Router.extend(); /

Router.map(function() {
  // Auth-example
  this.route('index', { path: '/' });
  this.route('protected');
  this.route('login');
  this.resource('patients', function() {
    this.route('new');
  });
});

export default Router;
Run Code Online (Sandbox Code Playgroud)

sam*_*sam 2

我的问题是我缺少“患者.hbs”模板 - 其中我有“患者/new.hbs”和“患者/index.hbs”。如果能抱怨一下或者说得更具体一点就好了。