As displayed below, even though i've 2 diff html i am using same controller so i want to have the scope shared between 2 html.
Is it possible to configure this in routeProvider?
.when('/cform', {
templateUrl: '/partials/clientForm.html',
controller: 'ClientCtrl', //Same Controller
})
.when('/vwClientManagement', {
templateUrl: '/partials/clientManagement.html',
controller: 'ClientCtrl' //Same Controller
})
$scope.showClientAddUpdateView = function(action,clientId) {
$scope.client.name="Hello World"; // This is getting displayed in UI.
$http.get("/qCli", { params:{id : clientId}}).then(
function successCallback(response){
//$scope.client = response.data;
$scope.client.name="Hello World After Ajax"; // This is not getting displayed in UI.
$location.path('/cform');
},function errorCallback(response){
console.log("err searching clients");
}
);
};
Update: Scanario 1 - changing route and setting scope in ajax success call back, loosing only those value which i have set in success callback after route change
Scanario 2 - updating scope in ajax success callback but not changing route, view is updated with correct values.
Added More details More Details