@@ -256,10 +256,6 @@ angular
256256 return a . constructor ? - 1 : a . name > b . name ? 1 : - 1 ;
257257 }
258258
259- function getLinks ( $route , getLinks ) {
260- return getLinks ( $route . current . params . version ) ;
261- }
262-
263259 $routeProvider
264260 . when ( '/docs' , {
265261 redirectTo : '/docs/' + versions [ 0 ]
@@ -271,17 +267,17 @@ angular
271267 . when ( '/docs/:version' , {
272268 controller : 'DocsCtrl' ,
273269 templateUrl : 'site/components/docs/docs.html' ,
274- resolve : { methods : getMethods , links : getLinks }
270+ resolve : { methods : getMethods }
275271 } )
276272 . when ( '/docs/:version/:module' , {
277273 controller : 'DocsCtrl' ,
278274 templateUrl : 'site/components/docs/docs.html' ,
279- resolve : { methods : getMethods , links : getLinks }
275+ resolve : { methods : getMethods }
280276 } )
281277 . when ( '/docs/:version/:module/:class' , {
282278 controller : 'DocsCtrl' ,
283279 templateUrl : 'site/components/docs/docs.html' ,
284- resolve : { methods : getMethods , links : getLinks }
280+ resolve : { methods : getMethods }
285281 } ) ;
286282 } )
287283
@@ -290,22 +286,27 @@ angular
290286
291287 $rootScope . $on ( '$routeChangeStart' , function ( event , route ) {
292288 var url = $location . path ( ) ;
289+
293290 if ( url . indexOf ( '/docs/' ) === - 1 || ( ! route . params || ! route . params . version ) ) {
294291 // This isn't a `docs` route or it's not one that expects a version.
295292 // No need to re-direct request.
296293 return ;
297294 }
295+
298296 if ( versions . indexOf ( route . params . version ) === - 1 ) {
299297 // No version specified where one was expected.
300298 // Route to same url with latest version prepended.
301299 event . preventDefault ( ) ;
302300 $route . reload ( ) ;
303301 $location . path ( url . replace ( 'docs/' , 'docs/' + versions [ 0 ] + '/' ) ) ;
302+ return ;
304303 }
304+
305+ $rootScope . ACTIVE_VERSION = route . params . version ;
305306 } ) ;
306307 } )
307308
308- . controller ( 'DocsCtrl' , function ( $location , $scope , $routeParams , methods , $http , links , versions ) {
309+ . controller ( 'DocsCtrl' , function ( $location , $scope , $routeParams , methods , $http , versions ) {
309310 'use strict' ;
310311
311312 $scope . isActiveUrl = function ( url ) {
@@ -340,7 +341,6 @@ angular
340341 $scope . methods = methods ;
341342 $scope . version = $routeParams . version ;
342343 $scope . versions = versions ;
343- $scope . links = links ;
344344 } )
345345
346346 . controller ( 'HistoryCtrl' , function ( $scope , versions ) {
0 commit comments