I am trying access the parent state from a child. I tried this but it doesn\'t work.
angular.module(\'myApp\').controller(\'compareCtrl\', [\'$scope\',
funct
UI-Router supports data (Model) sharing among state families. The detailed explanation could be found here
How do I share $scope data between states in angularjs ui-router?
Where we can see, that we need to introduce a Model, a cluster, a reference object.
// controller of the parent state 'services'
.controller('ServicesCtrl', ['$scope',
function($scope) {
$scope.Model = { prop1 : value1, ...};
}])
Because now each child state will prototypically inherit that reference to $scope.Model... we can access it in any child state controller
.controller('ServiceChildCtrl', ['$scope',
function($scope) {
$scope.Model.prop1 = differentValue;
}])
Check it in action in this working plunker