From 13ab1120a980e85aed88eebba1382f052bd6ec17 Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Thu, 18 Jun 2015 10:17:00 -0400 Subject: [PATCH] Move hasModelKey method to route instead of routeParams --- .../js/shared/route-extensions/model-listener.config.js | 2 +- .../js/shared/route-extensions/route-params.decorator.js | 6 +++--- awx/ui/static/js/system-tracking/system-tracking.route.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/awx/ui/static/js/shared/route-extensions/model-listener.config.js b/awx/ui/static/js/shared/route-extensions/model-listener.config.js index bf4bb5feba..92567cae03 100644 --- a/awx/ui/static/js/shared/route-extensions/model-listener.config.js +++ b/awx/ui/static/js/shared/route-extensions/model-listener.config.js @@ -11,7 +11,7 @@ export default '$routeParams', function($rootScope, $routeParams) { $rootScope.$on('$routeChangeStart', function(e, newRoute) { - wrapDelegate(newRoute.params); + wrapDelegate(newRoute); }); $rootScope.$on('$routeChangeSuccess', function(e, newRoute) { diff --git a/awx/ui/static/js/shared/route-extensions/route-params.decorator.js b/awx/ui/static/js/shared/route-extensions/route-params.decorator.js index 3597816c19..7702031c4b 100644 --- a/awx/ui/static/js/shared/route-extensions/route-params.decorator.js +++ b/awx/ui/static/js/shared/route-extensions/route-params.decorator.js @@ -6,8 +6,8 @@ export function wrapDelegate($delegate) { $delegate.hasModelKey = function hasModelKey(key) { - return $delegate.hasOwnProperty('model') && - $delegate.model.hasOwnProperty(key); + return $delegate.params.hasOwnProperty('model') && + $delegate.params.model.hasOwnProperty(key); }; return $delegate; @@ -16,7 +16,7 @@ export function wrapDelegate($delegate) { export default [ '$provide', function($provide) { - $provide.decorator('$routeParams', wrapDelegate); + $provide.decorator('$route', wrapDelegate); } ]; diff --git a/awx/ui/static/js/system-tracking/system-tracking.route.js b/awx/ui/static/js/system-tracking/system-tracking.route.js index ae3e457447..971a0f24f1 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.route.js +++ b/awx/ui/static/js/system-tracking/system-tracking.route.js @@ -33,7 +33,7 @@ export default { 'Rest', 'GetBasePath', function($route, $q, rest, getBasePath) { - if ($route.current.params.hasModelKey('inventory')) { + if ($route.current.hasModelKey('inventory')) { return $q.when($route.current.params.model.inventory); } @@ -53,7 +53,7 @@ export default { 'Rest', 'GetBasePath', function($route, $q, rest, getBasePath) { - if ($route.current.params.hasModelKey('hosts')) { + if ($route.current.hasModelKey('hosts')) { return $q.when($route.current.params.model.hosts); }