aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ngRoute/directive/ngView.js1
-rw-r--r--test/ngRoute/directive/ngViewSpec.js40
2 files changed, 41 insertions, 0 deletions
diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js
index 3b97367c..d67d8a76 100644
--- a/src/ngRoute/directive/ngView.js
+++ b/src/ngRoute/directive/ngView.js
@@ -176,6 +176,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
return {
restrict: 'ECA',
terminal: true,
+ priority: 1000,
transclude: 'element',
compile: function(element, attr, linker) {
return function(scope, $element, attr) {
diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js
index 1bce2b62..d354a355 100644
--- a/test/ngRoute/directive/ngViewSpec.js
+++ b/test/ngRoute/directive/ngViewSpec.js
@@ -600,6 +600,46 @@ describe('ngView animations', function() {
expect(itemA).not.toEqual(itemB);
var itemB = $animate.flushNext('enter').element;
}));
+
+ it('should render ngClass on ngView',
+ inject(function($compile, $rootScope, $templateCache, $animate, $location, $timeout) {
+
+ var item;
+ $rootScope.tpl = 'one';
+ $rootScope.klass = 'classy';
+ element = $compile(html('<div><div ng-view ng-class="klass"></div></div>'))($rootScope);
+ $rootScope.$digest();
+
+ $location.path('/foo');
+ $rootScope.$digest();
+
+ item = $animate.flushNext('enter').element;
+
+ $animate.flushNext('addClass').element;
+ $animate.flushNext('addClass').element;
+
+ expect(item.hasClass('classy')).toBe(true);
+
+ $rootScope.klass = 'boring';
+ $rootScope.$digest();
+
+ $animate.flushNext('removeClass').element;
+ $animate.flushNext('addClass').element;
+
+ expect(item.hasClass('classy')).toBe(false);
+ expect(item.hasClass('boring')).toBe(true);
+
+ $location.path('/bar');
+ $rootScope.$digest();
+
+ $animate.flushNext('leave').element;
+ item = $animate.flushNext('enter').element;
+
+ $animate.flushNext('addClass').element;
+ $animate.flushNext('addClass').element;
+
+ expect(item.hasClass('boring')).toBe(true);
+ }));
});
it('should not double compile when the route changes', function() {