-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-If doesn't work with ng-Include #3307
Comments
Did you try this? |
I haven't tried that. Thanks for the suggestion. But I must say, even if it worked, it would be less appetizing than ngSwitch. I really should be able to use ngIf in the same div, not in a wrapper div. It should be given the higher priority that ngSwitchWhen clearly has. In sum, that is a workaround, not a fix, and I think ngSwitch is the better workaround. Cheers. |
I'm having the same problem in Here is a plunker: http://plnkr.co/MtRpmI |
This is really annoying bug. Met it immediately after migration to 1.2.0rc. |
Same as @andr2: couldn't fix, rolling back 😢 |
Same as @thenikso. It's also worth noting that activating ng-if multiple times will add the ng-include multiple times too, as you can see on this plunker : http://plnkr.co/BJUu5E |
So, after the rc2 upgrade, it appears part of the problem is fixed. ng-if + ng-include now works, but you still get extra elements when they're on the same tag. |
There are two workarounds for this issue:
I agree, that as a user, I wanna be able to use There is another issue, that there is no error when a single element contain multiple transcluding directives. This issue will be fixed in 1.2 (see #4217). I'm closing this issue and creating a new one for allowing multiple transcluding directives on the same element (#4357). |
Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See angular#4357. Closes angular#3893 Closes angular#4217 Closes angular#3307
Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See angular#4357. Closes angular#3893 Closes angular#4217 Closes angular#3307
Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See #4357. Closes #3893 Closes #4217 Closes #3307
Ok, we decided to special case ng-if + ng-include to make this work, see #4726 Hopefully, we can solve this in a more general way in the future. |
Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See angular#4357. Closes angular#3893 Closes angular#4217 Closes angular#3307
Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See angular#4357. Closes angular#3893 Closes angular#4217 Closes angular#3307
This doesn't work ... although it seems it should:
This alternative works as expected:
The text was updated successfully, but these errors were encountered: