1
votes

So I've got an Ember select view inside of an each that changes the context. And I am assuming that's why I cannot get access to the controller property.

This is the code

{{#each stuff}}
    {{view Ember.Select class="form-control" content=../all_types value=type}}
{{/each}}


//In my controller 
//I have this variable
all_types: ['stuff', 'more stuff', 'even more stuff']

So I've tried all_types and ../all_types which seems to be the way to refer to the parent context. Even so, it's not working.

I do want to say that other Ember select views are working in the same way that I am trying with this one, the only difference is that they are outside of the each loop. Which is why I assume that the each is causing the issue.

1
What is it telling you in the console?tylerlindell
Can you show the surrounding code? I specifically want to see your controller and why you need the each helper in contexttylerlindell
My controller has a lot of code that can't really be shown. The stuff variable is from the model that I am iterating over.user1952811

1 Answers

1
votes

../ changes the context of the entire helper, not just a property, it's easier to think about it like this

{{view Ember.Select class="form-control" ../ content=all_types value=type}}

You'll need to rescope or change your each, assuming all_types was in the parent scope

{{#each item in stuff}}
    {{view Ember.Select class="form-control" content=all_types value=item.type}}
{{/each}}