Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b7af76b

Browse files
committed
fix(directives): correct priority of structural directives
BREAKING CHANGE: the priority of ngRepeat, ngSwitchWhen, ngIf, ngInclude and ngView has changed. This could affect directives that explicitly specify their priority. In order to make ngRepeat, ngSwitchWhen, ngIf, ngInclude and ngView work together in all common scenarios their directives are being adjusted to achieve the following precendence: Directive | Old Priority | New Priority ============================================= ngRepeat | 1000 | 1000 --------------------------------------------- ngSwitchWhen | 500 | 800 --------------------------------------------- ngIf | 1000 | 600 --------------------------------------------- ngInclude/ngView | 1000 | 400
1 parent 4357da8 commit b7af76b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/ng/directive/ngIf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
var ngIfDirective = ['$animate', function($animate) {
8181
return {
8282
transclude: 'element',
83-
priority: 1000,
83+
priority: 600,
8484
terminal: true,
8585
restrict: 'A',
8686
compile: function (element, attr, transclude) {

src/ng/directive/ngInclude.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
152152
function($http, $templateCache, $anchorScroll, $compile, $animate, $sce) {
153153
return {
154154
restrict: 'ECA',
155-
priority: 1000,
155+
priority: 400,
156156
terminal: true,
157157
transclude: 'element',
158158
compile: function(element, attr, transclusion) {

src/ng/directive/ngSwitch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ var ngSwitchDirective = ['$animate', function($animate) {
165165

166166
var ngSwitchWhenDirective = ngDirective({
167167
transclude: 'element',
168-
priority: 500,
168+
priority: 800,
169169
require: '^ngSwitch',
170170
compile: function(element, attrs, transclude) {
171171
return function(scope, element, attr, ctrl) {
@@ -177,7 +177,7 @@ var ngSwitchWhenDirective = ngDirective({
177177

178178
var ngSwitchDefaultDirective = ngDirective({
179179
transclude: 'element',
180-
priority: 500,
180+
priority: 800,
181181
require: '^ngSwitch',
182182
compile: function(element, attrs, transclude) {
183183
return function(scope, element, attr, ctrl) {

src/ngRoute/directive/ngView.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
176176
return {
177177
restrict: 'ECA',
178178
terminal: true,
179-
priority: 1000,
179+
priority: 400,
180180
transclude: 'element',
181181
compile: function(element, attr, linker) {
182182
return function(scope, $element, attr) {

0 commit comments

Comments
 (0)