How to call view's rerender function in controller?


#1

I use the ember-cli tool to build an app, but I can’t get my view,here is the code. the controller’s code:

import Ember from 'ember';

export default Ember.Controller.extend({
    selfView : null,

    toggle : function(){
         var selfView = this.selfView;  

The problem here, selfView always null, why?

        if(selfiew != null){
            selfView.splitScreenRefresh();
        }
    }
});

The view’s code:

import Ember from 'ember';

export default  Ember.View.extend({
    didInsertElement: function() {
        this._super();
        this.get('controller').set('selfView', this);
     },

    splitScreenRefresh : function(){
        this.rerender();
    }
});

#2

It seems to ember-cli’s bug. when I use the other controller to call the controller’s toggle function, like that

      this.get('controllers.split-screen').toggle();

it will create the new split-screen controller, not use the old one. Why?