Skip to content

Commit 8ee2afb

Browse files
committed
Merge pull request #684 from dlukez/state-null-fix
fix($state): allow null to be passed as 'params' param
2 parents 6798daa + 094dc30 commit 8ee2afb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/state.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
756756
return false;
757757
}
758758

759-
return isDefined(params) ? angular.equals($stateParams, params) : true;
759+
return isDefined(params) && params !== null ? angular.equals($stateParams, params) : true;
760760
};
761761

762762
/**

test/stateSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ describe('state', function () {
497497
it('should return true when the current state is passed', inject(function ($state, $q) {
498498
$state.transitionTo(A); $q.flush();
499499
expect($state.is(A)).toBe(true);
500+
expect($state.is(A, null)).toBe(true);
500501
expect($state.is('A')).toBe(true);
501502
expect($state.is(B)).toBe(false);
502503
}));

0 commit comments

Comments
 (0)