function querySearch(query) {
                var results = query ? self.states.filter(createFilterFor(query)) : self.states,
                    deferred;
                if (self.simulateQuery) {
                    deferred = $q.defer();
                    $timeout(function () {
                        deferred.resolve(results);
                    }, Math.random() * 1000, false);
                    return deferred.promise;
                } else {
                    return results;
                }
            }
/**
             * Search for states... use $timeout to simulate
             * remote dataservice call.
             */
Search for states... use $timeout to simulate
remote dataservice call.
Search for states ... use $timeout to simulate remote dataservice call .
function querySearch(query) {
                var results = query ? self.states.filter(createFilterFor(query)) : self.states,
                    deferred;
                if (self.simulateQuery) {
                    deferred = $q.defer();
                    $timeout(function () {
                        deferred.resolve(results);
                    }, Math.random() * 1000, false);
                    return deferred.promise;
                } else {
                    return results;
                }
            }
function querySearch ( query ) { var results = query ? self . states . filter ( createFilterFor ( query ) ) : self . states , deferred ; if ( self . simulateQuery ) { deferred = $q . defer ( ) ; $timeout ( function ( ) { deferred . resolve ( results ) ; } , Math . random ( ) * 1000 , false ) ; return deferred . promise ; } else { return results ; } }
Search for states... use $timeout to simulate
 remote dataservice call.
Search for states ... use $timeout to simulate remote dataservice call .