-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Ng-Include inside ng-switch should be allowed #4731
Comments
Please see #3584 (comment) and associated plunker.
|
Sorry, you are right. But it's little bit annoying. |
There were several changes to the compiler WRT to this that should have fixed this. If it's still a problem in 1.2.5, please let me know and I'll happily re-open this issue. Thanks! |
I'm seeing it in 1.2.8 |
I am seeing it in 1.2.7. |
Yeah, you can't have multiple element transclusion directives on the same element. I'm not totally sure how it would work if you could. If anyone has any ideas how that should work, feel free to make a proposal. |
Is this an issue, or is this actually working as intended; disregarding all knowledge of Angular, it seems like it should work, but doesn't. It would be nice to know if this is at all an issue worth worrying about. |
It is throwing an error instead of behaving strangely, which means it's working as intended. There isn't a sensible way to make this work. However, maybe people would like an |
I understand, but shouldn't ng-include function like your proposal of ng-include-inside, by default? Removing all knowledge of development, and angular for that matter, combining these two directives seems like it should work as intended. Seen as you can work around it by nesting an ng-include within the ng-switch-when... sort of makes it seem like this is a 'bug' even though it may not be. |
I don't think the template should restrict the structure of the output DOM like that. That would require all the transclusion directives like The solution would be to write I don't think there's any way to combine the two - It's the same if you make them target their contents - |
Actually, I think I meant to say the structure of the template should reflect the structure of the output. For example, This is especially important in tables when there isn't always an "intermediate" element you can add. |
you can see this links :http://bennadel.github.io/JavaScript-Demos/demos/mixed-ng-switch/ |
I still get the following error when I try to use ng-include in ng-switch (Angular 1.3.16 and also 1.4.0)
<div ng-controller="MyController">
<span ng-switch="x">
<div ng-switch-when="true" ng-include="'partial.html'"></div>
<div ng-switch-default>default</div>
</span>
</div> So what is the supposed way to do this now? or was this bug reintroduced? |
Its wise to use Switch Case in place of if then else if you have more the 5 to 6 Conditions. Nice to read this article. Well described about in-build Switch directives. To make your learning easier here I am sharing one more link http://jharaphula.com/how-to-use-switch-case-in-angularjs. These are the pure examples. |
In angular 1.0.7 working:
In angular 1.2 RC3
Error: Multiple directives [ngSwitchWhen, ngInclude] asking for transclusion.
The text was updated successfully, but these errors were encountered: