I tried to use the tabs in Angular Material to facilitate the navigation between dates (just slide tabs to change date) and I have also a date picker to jump quickly to another date.
The loading work fine; I initialized the date picker with the current date and load tabs with each day in the current month.
If I select a date in another month, I reload the tabs to show appropriate dates. To do this, I've add a $watch on the date picker. This work fine but at the end of $watch I set tabSelected who is the index of the tab to display. That part don't work because it's like the digest process is not finish.
I think about a solution: just rename the tabs with new value. But is there a way to reset the array and set the index like I do:
$scope.$watch('dateSelected', function (newValue, oldValue) {
if ((newValue.getMonth() != oldValue.getMonth())
|| (newValue.getFullYear() != oldValue.getFullYear())) {
$scope.tabs = initialiseGamesTabs($scope.dateSelected);
}
$scope.tabSelected = getTabSelected();
});