I have two views and I use routes to access them. My main view is a list that uses ListController.
That controller does an $http request and gets some data back and on success I do: $scope.data = response.data;
When I click on a list item, my route goes to #/view/:id
I am able to get the id using routeParams in my other controller: DetailController
Since $scope.data was part of the ListController, how do I access say $scope.data in my DetailController?
(or at least pass $scope.data[some Id] to DetailController)
EDIT
app.factory('dataService', function(data)
{
var data = data;
return data;
});
the answer was to place this in my DetailController. response.data was still available to me
presentationService().then(
function success(response)
{
log(response.data);
},
function error(response)
{
log(response);
}
);
dataServiceshould be making the $http requestthenin controller plunker.co/edit/o0opykZ7QOPfxGZCRNFp?p=preview