-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
{{outlet}} inside {{if}} = weird behavior #3929
Comments
I think that isn't possible to use the same outlet, in one template. You can use for example:
But not
Based on your fiddle, you can get the same behavior using the outlet outside of the
Give a look http://jsfiddle.net/marciojunior/nUKyQ/ |
I can see how having two {{outlet}}s in the same scope could be a problem, but given that these two are effectively in different scopes, I don't see why the template compiler isn't smart enough to deal with it. After all, it's possible to nest {{if}}s and {{each}}es, so the compiler does have to have some notion of a "context stack." By the way, I know I can move the {{outlet}} outside of the {{if}} in the jsfiddle example, but I can't in the real code, because in the real code the surrounding blocks are different. Imagine this:
There isn't a practical way to move the {{outlet}} outside of the {{if}} in this case. |
Looks like a duplicate of #3187. |
I wouldn't be surprised if the underlying cause is the same as in #3187, but the manifested behavior is actually the opposite; instead of a view disappearing when it shouldn't, in this case it's appearing when it shouldn't. So it's possible that it's a different issue. |
I'm having some trouble with a template where there are two {{outlets}} in an {{if}}, one inside the "then" branch and one inside the {{else}}:
What happens is that everything starts out fine, but eventually the markup that's supposed to go into the {{outlet}} ends up being inserted twice.
A jsfiddle demonstrating the behavior is here: http://jsfiddle.net/Steve_OH/V5ztf/
Run the fiddle; you start out in Edit View. Click on any of the three names and you'll see them properly rendered into the outlet. Now click on the Thumbnail View link (for the purposes of this example, Thumbnail View looks just like Edit View, except the names are in reverse order and there is no secondary outlet). Click on one of the names. This takes you back to Edit View, and the name is rendered correctly into the outlet as before. Now click on a different name. All of a sudden, the name is rendered twice. Once you get into this "bad" mode, there doesn't seem to be a way to get out without reloading.
The text was updated successfully, but these errors were encountered: