mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
Move hasModelKey method to route instead of routeParams
This commit is contained in:
parent
389eddfc8d
commit
13ab1120a9
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
];
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user