Example
Take a look at this Plunk example.
Context
The Plunk showcases a basic version of the task I need to accomplish. Essentially, I am trying to retrieve a person's record along with validation results that include class information for proper styling in the controller.
The Problem
The key feature in the sample is the self.Get function which applies validation logic and returns a result.
self.Get('0f8fad5b-d9cb-469f-a165-70867728950e').then(function(result){
$scope.person = result.person;
$scope.validationResult = result.ValidateResult;
});
Although $scope.person loads correctly (as evidenced by correct form values), $scope.validationResult does not load as expected.
The Inquiry
I suspect there may be a timing issue with the asynchronous calls. How can I modify this Plunk to ensure everything functions properly?
Nesting async calls within one another could be a potential solution, but given the complexity of the calls involved, this approach would lead to unreadable code and might not resolve all issues.