I am trying to bring some data from $scope 1 to $scope 2. Here below, I am trying to pass "project_data.title" or "$$scope.project_data.project_title" in $scope 1 to $scope.test in $scope 2.
[$scope A]
$scope.updateData = function(project_id){
$http.post("../crud/projects_update.php",{
project_id : $scope.project_data.project_id,
project_title : $scope.project_data.project_title // this should be passed to $scope B.
})
[$scope B]
$http.get('../crud/customers_read.php',{
}).then(function(response){
$scope.customer = [];
$scope.customers = response.data;
$scope.test = { name: $scope.project_data.project_title }; // This should come from $scope A.
});
I thought they are universal, but it seems it is not. How do you usually solve this kind of problem: binding the data for different $scope?
Thank you in advance!
$httpservice, and only inject it into the controllers where it's used.