with ui-router, any child and grandchild of a state has access to their parent and grandparents controller correct?
So for example a .state(resources.resource.rates) the .rate state controller has access to the $scope.objects in resource and resources (which all have their own controllers) right?
On the presumption I have a html set up where everything is a nested view within resources with a ui-view="content2". However I have another page within resource called rates I would like to open up in the same nested view as resources but also gets access to the resource controller as well.
.state('resources.resource.rates', {
url: '/rates',
views:{
"content2":{
templateUrl: 'templates/rates.html',
controller: 'CreateRatesCtrl'
}
}
})
my ng-href in my view links to the /resources/{{resource.Id}}/rates but doesn't open up the rates page in the resources ui-view.
so what I tried was setting the view to content2@resources like so
views:{
"content2@resources":{
templateUrl: 'templates/rates.html',
controller: 'CreateRatesCtrl'
}
}
This works in the sense that the html now populates the rates.html in the resources ui-view and with the ng-href as resources/{{resource.Id}}/rates but unfortunately I only have access to the resources scope objects. I have a resourceId that I need from the resource controller. Does setting content2@resources limit my scope access to only the resources controller in this case? If so how can I make it so I can get access to the resource controller as well?