Basically, how to access an unnamed state's controller in html? I'm generating states with a loop, including unnamed controllers in my SPA. Although the routes are working fine, the homepage ng-includes each of the states but obviously doesn't load each state controller on the /home route.
Here's an example of what I want, which works fine when I navigate to /about and {{thisData}} = 'about Data' as expected but I want that $scope also on the /home route that has ng-include.
<div ng-include="'views/about.html'" ng-controller="the about state's controller"></div>
In my app.js..
var routes, setRoutes;
routes = ['home','about','services','clients','articles','media','admin', '404'];
setRoutes = function(route) {
var state, config;
state = route;
config = {
url: '/' + route,
templateUrl: 'views/' + route + '.html',
controller: function($scope, $state){
$scope.thisData = route + " Data";
}
}
$stateProvider.state(state, config);
return $stateProvider;
};
routes.forEach(function(route) {
console.log(route);
return setRoutes(route);
});