mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Move hasModelKey method to route instead of routeParams
This commit is contained in:
@@ -11,7 +11,7 @@ export default
|
|||||||
'$routeParams',
|
'$routeParams',
|
||||||
function($rootScope, $routeParams) {
|
function($rootScope, $routeParams) {
|
||||||
$rootScope.$on('$routeChangeStart', function(e, newRoute) {
|
$rootScope.$on('$routeChangeStart', function(e, newRoute) {
|
||||||
wrapDelegate(newRoute.params);
|
wrapDelegate(newRoute);
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('$routeChangeSuccess', function(e, newRoute) {
|
$rootScope.$on('$routeChangeSuccess', function(e, newRoute) {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
export function wrapDelegate($delegate) {
|
export function wrapDelegate($delegate) {
|
||||||
$delegate.hasModelKey = function hasModelKey(key) {
|
$delegate.hasModelKey = function hasModelKey(key) {
|
||||||
return $delegate.hasOwnProperty('model') &&
|
return $delegate.params.hasOwnProperty('model') &&
|
||||||
$delegate.model.hasOwnProperty(key);
|
$delegate.params.model.hasOwnProperty(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
return $delegate;
|
return $delegate;
|
||||||
@@ -16,7 +16,7 @@ export function wrapDelegate($delegate) {
|
|||||||
export default
|
export default
|
||||||
[ '$provide',
|
[ '$provide',
|
||||||
function($provide) {
|
function($provide) {
|
||||||
$provide.decorator('$routeParams', wrapDelegate);
|
$provide.decorator('$route', wrapDelegate);
|
||||||
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default {
|
|||||||
'Rest',
|
'Rest',
|
||||||
'GetBasePath',
|
'GetBasePath',
|
||||||
function($route, $q, 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);
|
return $q.when($route.current.params.model.inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ export default {
|
|||||||
'Rest',
|
'Rest',
|
||||||
'GetBasePath',
|
'GetBasePath',
|
||||||
function($route, $q, 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);
|
return $q.when($route.current.params.model.hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user