Skip to content

Commit

Permalink
fix(directives): correct priority of structural directives
Browse files Browse the repository at this point in the history
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
  • Loading branch information
IgorMinar authored and jamesdaily committed Jan 27, 2014
1 parent 479a320 commit dcd36f1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ng/directive/ngIf.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
var ngIfDirective = ['$animate', function($animate) {
return {
transclude: 'element',
priority: 1000,
priority: 600,
terminal: true,
restrict: 'A',
compile: function (element, attr, transclude) {
Expand Down
2 changes: 1 addition & 1 deletion src/ng/directive/ngInclude.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
function($http, $templateCache, $anchorScroll, $compile, $animate, $sce) {
return {
restrict: 'ECA',
priority: 1000,
priority: 400,
terminal: true,
transclude: 'element',
compile: function(element, attr, transclusion) {
Expand Down
4 changes: 2 additions & 2 deletions src/ng/directive/ngSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var ngSwitchDirective = ['$animate', function($animate) {

var ngSwitchWhenDirective = ngDirective({
transclude: 'element',
priority: 500,
priority: 800,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
Expand All @@ -177,7 +177,7 @@ var ngSwitchWhenDirective = ngDirective({

var ngSwitchDefaultDirective = ngDirective({
transclude: 'element',
priority: 500,
priority: 800,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
Expand Down
2 changes: 1 addition & 1 deletion src/ngRoute/directive/ngView.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
return {
restrict: 'ECA',
terminal: true,
priority: 1000,
priority: 400,
transclude: 'element',
compile: function(element, attr, linker) {
return function(scope, $element, attr) {
Expand Down

0 comments on commit dcd36f1

Please sign in to comment.