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

Broken if / yield combo inside view's layout template #10402

Closed
panta82 opened this issue Feb 9, 2015 · 3 comments
Closed

Broken if / yield combo inside view's layout template #10402

panta82 opened this issue Feb 9, 2015 · 3 comments
Milestone

Comments

@panta82
Copy link

panta82 commented Feb 9, 2015

Inside a view's layout:

    {{#if view.hasContent}}
        <h3>Content</h3>
        {{yield}}
    {{/if}}

It seems that {{yield}} template gets incorrect context if it's called from inside an {{#if}} block.

Working fiddle with ember 1.9.1: http://emberjs.jsbin.com/roboqegege/1/edit
As you can see, context is as expected: this and this.controller lead to controller and this.view lead to view instance.

The same code in 1.10: http://emberjs.jsbin.com/zerodanuhe/3/edit

To get the code working, change layoutName from "holder" to "holder_working". This is the same template as before, only without an {{#if}} block.

@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

Likely related to #10401.

@ebryn
Copy link
Member

ebryn commented Feb 18, 2015

@cwarny
Copy link

cwarny commented Apr 23, 2015

I'm encountering a similar problem. Maybe my approach is wrong and this is a feature, but when inside a controller template I wrap a {{yield}} inside an {{#if}}, the content does not get rendered. I use Ember 1.11.1. Here's a jsbin: http://emberjs.jsbin.com/yakixihedi/1/edit?html,js,output

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

4 participants