@@ -67,26 +67,30 @@ angular.module('crunchinatorApp.controllers')
6767 //Bind component data services to the scope, so we can use them in the views
6868 $scope . ComponentData = ComponentData ;
6969
70- var deferred = $q . defer ( ) ;
71- function applyFilters ( ) {
72- _ . delay ( function ( ) {
73- $scope . $apply ( function ( ) {
74- Company . runFilters ( filterData ) ;
75- Category . runFilters ( filterData ) ;
76- Investor . runFilters ( filterData ) ;
7770
78- deferred . resolve ( 'Finished filters' ) ;
79- } ) ;
80- } , 300 ) ;
81-
82- return deferred . promise ;
83- }
8471
8572 //All of our filters broadcast 'filterAction' when they've been operated on
8673 //When a filter receives input we set up filterData and run each model's filters
8774 //This should automatically update all the graph displays
8875 $scope . $on ( 'filterAction' , function ( ) {
76+
77+ var deferred = $q . defer ( ) ;
78+ function applyFilters ( ) {
79+ _ . delay ( function ( ) {
80+ $scope . $apply ( function ( ) {
81+ Company . runFilters ( filterData ) ;
82+ Category . runFilters ( filterData ) ;
83+ Investor . runFilters ( filterData ) ;
84+
85+ deferred . resolve ( 'Finished filters' ) ;
86+ } ) ;
87+ } , 250 ) ;
88+
89+ return deferred . promise ;
90+ }
91+
8992 $scope . loading = true ;
93+
9094 filterData . categoryIds = _ . pluck ( $scope . selectedCategories , 'id' ) ;
9195 filterData . companyIds = _ . pluck ( $scope . selectedCompanies , 'id' ) ;
9296 filterData . investorIds = _ . pluck ( $scope . selectedInvestors , 'id' ) ;
0 commit comments