I am doing my first steps with AngularJS and have a pretty basic question. I have an overview page with some products and want a detail view for each of these products. Here is the relevant code from my controllers:
shop.controller('OverviewController', ['$scope', '$location', 'Overview', function($scope, $location, Overview){
console.log($scope.currentDetail); //always undefined
$scope.overview = Overview.get();
$scope.showDetails = function(product){
$scope.currentDetail = product;
console.log($scope.currentDetail); //output as expected
$location.path("/productDetail");
}
}
]);
shop.controller('DetailController', ['$scope', function($scope){
console.log($scope.currentDetail);
}
]);
The relevant part from the overview page is like this:
<table class="table table-hover">
<tr ng-repeat="product in overview.product" ng-click="showDetails(product);">
<td>
{{product.DESCRIPTION}}
</td>
</tr>
</table>
Problem is that the the output of console.log($scope.currentDetail); is always undefined. I think I am missing some basic concept of the $scope here. Any help is much appreciated.