I am currently utilizing angularjs 1.0 within my application. There is a dropdown on my cshtml page
<select tabindex="2" id="Employee" ng-model="models.SelectedEmployee" ng-change="changeEmployee()" disabled="disabled" class="Answer" size="6">
<option value="-1" selected="selected">Select</option>
<option ng-repeat="option in models.Employees | orderBy:'EmployeeName'" value="{{option.EmployeeKey}}"> {{option.EmployeeName}} - {{option.EmployeeKey}}</option>
</select>
When the Employee selection changes, I call the function changeEmployee()
$scope.changeEmployee = function () {
$scope.ClearMessages(); //function to clear messages displayed in the label field (lblMessage)
$scope.FetchAllEmployeeData(); //retrieves Employee details such as address and dependents details
}
The FetchAllEmployeeData function retrieves employee details from the database and if present, adds messages to the label field (lblMessage) such as "Address Details Found" or "Dependents Details Found".
Everything works correctly when a user selects an Employee name from the dropdown. However, if a user utilizes the down key button to quickly navigate through each Employee, the FetchAllEmployeeData function continues adding messages for every Employee. I believe this is happening because FetchAllEmployeeData does not wait for the ClearMessage function to finish.
I would appreciate any assistance in managing this scenario.