I have a tricky situation here. my parent state and child state are both overriding the same ui view at the top level(index.html). So when it goes to the child state from the parent the scope gets broken(I think?) Basically the parent has a resolve which is stored in the MetricData property that I can't seem to access from the child since its not nested I am assuming. Is there a way to get that metricdata property in the child without having to manually call the same ajax call again in the child
parent state
.state("home.metric", {
url: "/category/:categoryId/metric/:metricId/name/:metricName",
views: {
'main@': {
templateUrl:
function (stateParams){
//move this to a util function later
var tempName = unescape(stateParams.metricName);
tempName = tempName.replace(/\s/g, "-");
return '../partials/slides/' + tempName + '.html';
},
resolve: {
MetricData: ['MetricService', '$stateParams',
function(MetricService, $stateParams){
var data = { categoryId : $stateParams.categoryId, metricId : $stateParams.metricId};
return MetricService.getMetricDetails(data);
}]
},
controllerProvider:
function ($stateParams) {
var tempName = unescape($stateParams.metricName);
tempName = tempName.replace(/\s+/g, '');
return tempName + 'Ctrl';
}
}
}
})
child state
.state("home.metric.detail", {
url: "/detailId/:detailId/detailName/:detailName",
views: {
'main@': {
templateUrl:
function ($stateParams){
//move this to a util function later
var tempName = unescape($stateParams.detailName);
tempName = tempName.replace(/\s/g, "-");
return '../partials/slides/' + tempName + '.html';
},
resolve: {
DetailData: ['DetailService', '$stateParams',
function(DetailService, $stateParams){
var data = { categoryId : $stateParams.categoryId, detailId : $stateParams.detailId};
return DetailService.getDetails(data);
}],
// MetricData: ['MetricService', '$stateParams',
// function(MetricService, $stateParams){
// var data = { categoryId : $stateParams.categoryId, metricId : $stateParams.metricId};
// return MetricService.getMetricDetails(data);
// }]
},
controllerProvider:
function ($stateParams) {
var tempName = unescape($stateParams.detailName);
tempName = tempName.replace(/\s+/g, '');
return tempName + 'Ctrl';
}
}
}
})