I am fairly new to angularjs, so please bear with me.
I have two controllers, one of which has a Restangular call to load a certain json object. How do I access this same json object in another controller without making another Restangular call?
I already tried making a factory
that shares the object, but this is far from working.
app.factory('Data', function() {
return []
}
app.controller("FirstCtrl", function ($scope, AudioRestangular, Data) {
$scope.audios_full = Data
// load data into $scope.audios_full using restangular
}
app.controller("SecondCtrl", function ($scope, AudioRestangular, Data) {
/*
* $scope.second_ctrl_audios = ?
* get data from FirstCtrl's audios_full
* and store it in this $scope.second_ctrl_audios
*/
}