未捕获的TypeError:无法读取null的属性“transitionToRoute”

时间:2014-09-24 04:04:20

标签: javascript ember.js

您好我正在使用ember作为我的客户端应用程序。我的代码在emberView

当我想在kill动作中使用transitionToRoute时,它显示上述错误。

我的路线就像这样

App.Router.map(function () {
  this.route('groups');
  this.resource('group', { path: 'group/:uuid' }, function() {
    this.route('people');
    this.route('vehicles');
    this.route('reports');
    this.route('geofences');
  });
 });

目前我正处于子视图的路径(group /:uuid / people),如果我调用上述Tile View of kill动作,它已重定向到(group)的parentRoute

App.TileView = Ember.View.extend({
actions:{

     kill: function() {
        var dfd = new $.Deferred();
        var t = this,resolveEntity = false;
        this.set('waitingOnDelete', true);

        //this.get('entity').kill().done(this.remove.bind(this));

        var pid = this.get('entity').id;
        this.get('entity').kill().then(function() {
            t.remove();
            if ((t.get('entityType') === 'association') && (DS.session.user_uuid === pid)) {
                resolveEntity = true;
                dfd.resolve(resolveEntity);
                if(resolveEntity){
                  t.get('controller').transitionToRoute('groups');
                }
            }
        });

    }
}
});

0 个答案:

没有答案