@@ -968,6 +968,9 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
968968 var from = $state . $current , fromParams = $state . params , fromPath = from . path ;
969969 var evt , toState = findState ( to , options . relative ) ;
970970
971+ // Store the hash param for later (since it will be stripped out by various methods)
972+ var hash = toParams [ '#' ] ;
973+
971974 if ( ! isDefined ( toState ) ) {
972975 var redirect = { to : to , toParams : toParams , options : options } ;
973976 var redirectResult = handleRedirect ( redirect , from . self , fromParams , options ) ;
@@ -1117,6 +1120,9 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
11171120 }
11181121 }
11191122
1123+ // Re-add the saved hash before we start returning things
1124+ if ( hash ) toParams [ '#' ] = hash ;
1125+
11201126 // Run it again, to catch any transitions in callbacks
11211127 if ( $state . transition !== transition ) return TransitionSuperseded ;
11221128
@@ -1342,7 +1348,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
13421348 if ( ! nav || nav . url === undefined || nav . url === null ) {
13431349 return null ;
13441350 }
1345- return $urlRouter . href ( nav . url , filterByKeys ( state . params . $$keys ( ) , params || { } ) , {
1351+ return $urlRouter . href ( nav . url , filterByKeys ( state . params . $$keys ( ) . concat ( '#' ) , params || { } ) , {
13461352 absolute : options . absolute
13471353 } ) ;
13481354 } ;
0 commit comments