-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-controller is not working in conjunction with ng-include in 1.2.0-rc.3 #4431
Comments
I've also just been bitten by this, like you I found the issue was introduced between 1.2.0-rc.2 and 1.2.0-rc.3 |
confirmed. just reverted to RC2 |
Could this be the cause: http://stackoverflow.com/questions/19405053/angular-1-2-0-rc-3-directive-priority-change-issue? |
I, too, can replicate this. |
Happening for me as well. What I think is happening: The template is attached to the parent controller before the controller on that element is initiated, creating a sibling relationship instead of child-parent. |
Also noted in #4521 |
@asilluron's fix works. Thanks! |
seconded to @asiluron's fix, changing controller's priority to 1000 |
To monkey patch this in the mean time I've decorated ngController to change the priority: $provide.decorator('ngControllerDirective', ['$delegate', function($delegate) {
$delegate[0].priority = 900;
return $delegate;
}]); |
Genuine question: why was this not addressed for 1.2.0? Is this not supposed to work, or is this setup not recommended? We've been using this a lot. |
This issue was introduced with this commit: 5eb1fb6 This explains why increasing ngController's priority to 1000 fixes the issue. I believe that this is the right solution but the question is what is the best priority for ngController? |
Stumbled on this issue too, same use case (declaring controller and include on the same element). Nesting the include inside the controller is a workaround but it messes up the DOM structure: <div ng-controller="HelloCtrl">
<div class="hello" ng-include src="'hello'"></div>
</div> A fix would be greatly appreciated. :) |
Thanks totof3110, works perfectly, made my day! |
sadly, not fixed in 1.2.1 either |
Priority is also broken with ng-show and ng-include - the partial defined in an ng-include will always be displayed even if the no-show condition is false
|
@totof3110 Agree with you, that workaround works, but DOM is not clear. |
В 1.2.1 не работает (not work): |
I reported that again. Did not see this one. |
This fix will be in 1.2.2. |
This changes the priority of ngController to 500 so that it takes precedence over ngInclude. Closes angular#4431, angular#4521
need workaround for ng-controller + ng-include ( angular/angular.js#4431 )
This changes the priority of ngController to 500 so that it takes precedence over ngInclude. Closes angular#4431, angular#4521
This changes the priority of ngController to 500 so that it takes precedence over ngInclude. Closes angular#4431, angular#4521
Hello, when I use the next code: I get this error: Error: [$injector:unpr] http://errors.angularjs.org/1.2.21/$injector/unpr?p0=highlightFilterProvider%20%3C-%20highlightFilter and my browser crashes, as if would be in an infinite loop. some body can help me. |
@WalterC87 could you post a reproduction to plnkr.co or jsbin.com? thanks! |
When we are trying to declare something like
After
hello
template is inserted -HelloCtrl
will not be applied for template.Demo: http://jsbin.com/ekelOMI/2/edit
In 1.2.0-rc.2 everything works fine.
The text was updated successfully, but these errors were encountered: