@@ -256,10 +256,6 @@ angular
256
256
return a . constructor ? - 1 : a . name > b . name ? 1 : - 1 ;
257
257
}
258
258
259
- function getLinks ( $route , getLinks ) {
260
- return getLinks ( $route . current . params . version ) ;
261
- }
262
-
263
259
$routeProvider
264
260
. when ( '/docs' , {
265
261
redirectTo : '/docs/' + versions [ 0 ]
@@ -271,17 +267,17 @@ angular
271
267
. when ( '/docs/:version' , {
272
268
controller : 'DocsCtrl' ,
273
269
templateUrl : 'site/components/docs/docs.html' ,
274
- resolve : { methods : getMethods , links : getLinks }
270
+ resolve : { methods : getMethods }
275
271
} )
276
272
. when ( '/docs/:version/:module' , {
277
273
controller : 'DocsCtrl' ,
278
274
templateUrl : 'site/components/docs/docs.html' ,
279
- resolve : { methods : getMethods , links : getLinks }
275
+ resolve : { methods : getMethods }
280
276
} )
281
277
. when ( '/docs/:version/:module/:class' , {
282
278
controller : 'DocsCtrl' ,
283
279
templateUrl : 'site/components/docs/docs.html' ,
284
- resolve : { methods : getMethods , links : getLinks }
280
+ resolve : { methods : getMethods }
285
281
} ) ;
286
282
} )
287
283
@@ -290,22 +286,27 @@ angular
290
286
291
287
$rootScope . $on ( '$routeChangeStart' , function ( event , route ) {
292
288
var url = $location . path ( ) ;
289
+
293
290
if ( url . indexOf ( '/docs/' ) === - 1 || ( ! route . params || ! route . params . version ) ) {
294
291
// This isn't a `docs` route or it's not one that expects a version.
295
292
// No need to re-direct request.
296
293
return ;
297
294
}
295
+
298
296
if ( versions . indexOf ( route . params . version ) === - 1 ) {
299
297
// No version specified where one was expected.
300
298
// Route to same url with latest version prepended.
301
299
event . preventDefault ( ) ;
302
300
$route . reload ( ) ;
303
301
$location . path ( url . replace ( 'docs/' , 'docs/' + versions [ 0 ] + '/' ) ) ;
302
+ return ;
304
303
}
304
+
305
+ $rootScope . ACTIVE_VERSION = route . params . version ;
305
306
} ) ;
306
307
} )
307
308
308
- . controller ( 'DocsCtrl' , function ( $location , $scope , $routeParams , methods , $http , links , versions ) {
309
+ . controller ( 'DocsCtrl' , function ( $location , $scope , $routeParams , methods , $http , versions ) {
309
310
'use strict' ;
310
311
311
312
$scope . isActiveUrl = function ( url ) {
@@ -340,7 +341,6 @@ angular
340
341
$scope . methods = methods ;
341
342
$scope . version = $routeParams . version ;
342
343
$scope . versions = versions ;
343
- $scope . links = links ;
344
344
} )
345
345
346
346
. controller ( 'HistoryCtrl' , function ( $scope , versions ) {
0 commit comments