0

How to share an object between two controllers in angular JS?

These are my controllers: //First ctrl

idxcontrollers.controller('myCtrl',function($scope,$location,$rootScope,productService) {
$scope.rowClick = function(item){
//i want to pass a item obj to rowCtrl
$location.path('/detail/'+item.id);
}
}
//Second Ctrl
idxcontrollers.controller('rowCtrl',function($scope,$location,$routeParams,productService) {
    //here i want to get item obj.
});

Here i do not want to pass a obj.value1 or obj.value2. first of all i want to pass a whole object then in second Ctrl i will spearate them based on their values.

Harsh Shah
  • 2,162
  • 2
  • 19
  • 39

0 Answers0