My application does a http call, the result is stored in a variable in the scope.
angular.module('simfraAppController', [])
.controller('simfraController', ['$scope', 'RetrieveInformation', 'RetrieveTaxInformation', 'ErrorModal',
function ($scope,RetrieveInformation, RetrieveTaxInformation, ErrorModal) {
$scope.formData = {};
RetrieveInformation.then(function success(response) {
$scope.personalData = response.data.data;
}, function error(response) {
ErrorModal();
});
RetrieveTaxInformation.then(function success(response) {
$scope.taxData = response.data.data;
}, function error(response) {
ErrorModal();
});
}
]);
.state('landing', {
url: "/",
templateUrl: "simfra/dashboard.html"
})
In this controller is the call made and sto in the variable.
This is my other controller
.controller('SimfraDirectDebitApplicationController', ['$scope', '$rootScope', '$state', 'Command', 'uuid4',
function ($scope, $rootScope, $state, Command, uuid4) {
console.log($scope.personalData);
});
.state('direct_debit_application', {
url: "/incassoaanvraag",
templateUrl: "simfra/direct-debit-application/inquiry.html"
})
Ofcourse i have nested the html.
<body data-ng-controller="simfraController">
<div data-ng-controller="SimfraDirectDebitApplicationController">
</div>
</div>
My problem is when i init the application trough the default route "/" and i navigate to the route "direct_debit_application" it all works great.
BUT, when i reload the page, the request is still being made (as far as i can see in the console) but the variable is 'undefined'
How can i get this thing to work properly?