diff --git a/src/ng1/stateDirectives.ts b/src/ng1/stateDirectives.ts index 9e8b3839e..417eaeaa8 100644 --- a/src/ng1/stateDirectives.ts +++ b/src/ng1/stateDirectives.ts @@ -329,6 +329,7 @@ function $StateRefActiveDirective($state, $stateParams, $interpolate) { function exactMatch(state, params) { return $state.is(state.name, params); } + update(); }] }; } diff --git a/test/stateDirectivesSpec.js b/test/stateDirectivesSpec.js index d00c491b2..2c13db404 100644 --- a/test/stateDirectivesSpec.js +++ b/test/stateDirectivesSpec.js @@ -661,5 +661,15 @@ describe('uiSrefActive', function() { expect(el[0].className).toMatch(/admin/); expect(el[0].className).not.toMatch(/contacts/); })); + + it('should update the active classes when compiled', inject(function($compile, $rootScope, $document, $state, $q) { + $state.transitionTo('admin.roles'); + $q.flush(); + timeoutFlush(); + el = $compile('
')($rootScope); + $rootScope.$digest(); + timeoutFlush(); + expect(el.hasClass('active')).toBeTruthy(); + })); }); });