Change trigger to update filters after ProductsCtrl is loaded.

This commit is contained in:
Steve Roberts
2020-08-27 18:02:01 +10:00
parent 4e635e114c
commit ef0038a661

View File

@@ -12,6 +12,11 @@ Darkswarm.controller "ProductsCtrl", ($scope, $sce, $filter, $rootScope, Product
$scope.supplied_properties = null
$scope.showFilterSidebar = false
# Update filters after initial load of shop tab
$timeout =>
$scope.update_filters()
# Update filters when order cycle changed
$rootScope.$on "orderCycleSelected", ->
$scope.update_filters()
$scope.clearAll()
@@ -49,7 +54,6 @@ Darkswarm.controller "ProductsCtrl", ($scope, $sce, $filter, $rootScope, Product
$scope.$watch 'query', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue
$scope.$watchCollection 'activeTaxons', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue
$scope.$watchCollection 'activeProperties', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue
$scope.$watch 'Products.loading', (newValue, oldValue) -> $scope.update_filters() if newValue == false && newValue != oldValue
$scope.loadProducts = ->
$scope.page = 1