Note that there are some explanatory texts on larger screens.

plurals
  1. PONeeds and this.get('controllers') give wrong results when used with outlet in partial view?
    primarykey
    data
    text
    <p>Hi and thanks a lot for your precious help on this problem. </p> <p>As I am quite new in EmberJS' world, problem may come from me and not Ember, but I don't find the right way to fix it. </p> <p>I have a template named a, a view named AAView (with its template, too) and two controllers AAController and BController. </p> <p>Template 'a' is rendered by using partial method : </p> <p>{{partial 'a'}}</p> <p>AAController is controller for AAView, connected to AAOutlet which is in 'a' template with </p> <pre><code>this.render('aa', { outlet: 'AAOutlet', into: 'application' }); </code></pre> <p>In this AAView, I have an observer that <strong>should</strong> observes <em>isShown</em> property of AAController.</p> <pre><code>App.AAView = Ember.View.extend({ visibilityDidChanged: function() { console.log('Visibility just changed man! Do something!'); }.observes('controller.isShown') }); </code></pre> <p>This <em>isShown</em> variable is in AAController then... </p> <pre><code>App.AAController = Ember.ObjectController.extend({ isShown: false }); </code></pre> <p>And this variable is set in an other controller (BController) :</p> <pre><code>App.BController = Ember.ObjectController.extend({ needs: ['AA'], myVal: '', myValDidChanged:function() { //Conditions and a lot of interesting stuffs this.get('controllers.AA').set('isShown', true); }.observes('myVal') }); </code></pre> <p>When my script is executed and reach this code, the view is <strong>not notified</strong> about the change in controller... </p> <p>If I stop debugger on <em>this.get('controllers.AA').set('isShown', true);</em> line, it seems that <em>this.get('controllers.AA')</em> returns an other (or a new ?) controller and not the controller used and observed by the view.</p> <p>Thus where is the problem and how can I retrieve the right controller in BController to edit the value and trigger the observer in the view ? </p> <p><strong><a href="http://jsfiddle.net/x6emd/1/" rel="nofollow">--> Here is a jsFiddle with a simplified version of the problem.</a></strong></p> <p>Huge thanks for your help on this one!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload