I have the following HTML section in a corner application. The <div /> tag for the destination list shows the list of destinations. This directive is basically a table.
<div ng-show="loading">Loading...</div> <div ng-show="!loading && (appointments.length == 0)">No Appointments Found</div> <div ng-hide="loading || (appointments.length == 0)">Test123</div> <div ng-hide="loading || (appointments.length == 0)" appointment-list source="appointments" appointment-selected="appointmentSelected(appointment)"></div>
Then I have the following in the controller. I set the load variable while something is in flight, and then I also filter the appointments on the page according to the text in the text box.
$scope.$watch('selectedDate', function(newVal, oldVal) { if (newVal) { $scope.loading = true; Appointment.query({year: newVal.getYear()+1900, month: newVal.getMonth()+1, day: newVal.getDate()}, function(data) { $scope.allAppointments = data; $scope.appointments = $scope.filterAppointments(); $scope.loading = false; }); } });
My problem is that hiding the div for my custom directive is going wrong. The table should disappear exactly along with the line "Test123", but it doesnβt. When I move from the selected date with a table filled to a date where there is nothing, βTest123β will be replaced by the download (for this it will be hidden and the download will be shown), but the table remains until the download process is complete, after why the table will disappear
Can someone explain why the delay? Why doesn't the directive respond exactly like the div above it?
Edit
Here is plnkr which shows the problem: http://plnkr.co/edit/khxQuaM6sxTx5RszvowX?p=preview
Basically click on the buttons at the top to load two datasets. I have a timeout to simulate some time on the server. Whenever you see "Loading ...", the div for the meetingList table should not be displayed, since ng-hide will evaluate to true because the load is true, but does not disappear.
source share