Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-context switching {{#with}} switches context inside of an {{#each}} loop #10370

Closed
markprzepiora opened this issue Feb 6, 2015 · 2 comments
Milestone

Comments

@markprzepiora
Copy link

With the following controllers,

App.FoosController = Ember.ArrayController.extend({
  itemController: 'foo'
});

App.FooController = Ember.Controller.extend();

and the following foos template,

     <p>Outside of the loop, "this" is {{this}}</p>
     {{#each this as |fooController|}}
       <p>Inside of the loop, "this" is still {{this}}</p>
       {{#with fooController.model as |foo|}}
         <p>But inside of the "with" within the loop, "this" is {{this}}</p>
       {{/with}}
     {{/each}}

and the application template being just,

    {{render "foos" items}}

Since I'm using the non-context-switching versions of all the helpers, I expect every {{this}} to be the same (namely, FoosController). But instead the first two {{this}} statements print out FoosController, but the third prints out FooController.

Is this a bug or am I completely misunderstanding something?

JSBin here: http://jsbin.com/fuqota/5/edit?html,js,output

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

I believe this is related to #10401.

@rwjblue rwjblue added this to the 1.10.1 milestone Feb 10, 2015
@rwjblue
Copy link
Member

rwjblue commented Feb 23, 2015

This was fixed by #10489.

@rwjblue rwjblue closed this as completed Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants