I have the following routes:
$stateProvider
.state("base",
{
url: "",
abstract: true,
resolve: {
aService: "aService",
dataNeeded: function(aService) {
return aService.getDataMethod().$promise;
}
},
template: "<ui-view/>",
});
$stateProvider
.state("base.main",
{
url: "/",
templateUrl: coreConfig.path() + "/modules/content/content.tmpl.html",
controller: "aController",
controllerAs: "aCtrl",
data: { requiresLogin: true }
});
I'm using an abstract route to resolve data required in the child 'base.main'
route.
and in my app.js file I have
angular.module("aModule", ["CoreModule"])
.controller({ "aController": require("./modules/content/aController.controller.js") });
I have my controller:
module.exports = ["aService", "dataNeeded", aController];
function aController(aService, dataNeeded) {
var test = dataNeeded; //value is undefined
}
How do I access the 'dataNeeded'
loaded in the abstract route from within the `'base.main' controller?