@@ -28,10 +28,13 @@ angular.module('spotmop.search', [])
2828 $scope . artists = [ ] ;
2929 $scope . playlists = [ ] ;
3030 $scope . type = $stateParams . type ;
31- $scope . query = $filter ( 'stripAccents' ) ( $stateParams . query ) ;
31+ $scope . query = '' ;
32+ if ( $stateParams . query )
33+ $scope . query = $filter ( 'stripAccents' ) ( $stateParams . query ) ;
34+
3235 $scope . loading = false ;
3336 var searchDelayer ;
34-
37+
3538 // focus on our search field on load (if not touch device, otherwise we get annoying on-screen keyboard)
3639 if ( ! $scope . isTouchDevice ( ) )
3740 $ ( document ) . find ( '.search-form input.query' ) . focus ( ) ;
@@ -40,31 +43,6 @@ angular.module('spotmop.search', [])
4043 if ( $scope . query )
4144 performSearch ( $scope . type , $scope . query ) ;
4245
43- /**
44- * Watch our query string for changes
45- * When changed, clear all results, wait for 0.5 seconds for next key, then fire off the search
46- var tempQuery = '', queryTimeout;
47- $scope.$watch('query', function(newValue, oldValue){
48-
49- if( newValue != oldValue && newValue && newValue != '' ){
50- $scope.loading = true;
51- $scope.tracklist = {tracks: [], type: 'track'};
52- $scope.albums = [];
53- $scope.artists = [];
54- $scope.playlists = [];
55-
56- if (queryTimeout)
57- $timeout.cancel(queryTimeout);
58-
59- tempQuery = newValue;
60- queryTimeout = $timeout(function() {
61- $scope.query = tempQuery;
62- performSearch( $scope.type, $scope.query );
63- }, 1000);
64- }
65- })
66- **/
67-
6846
6947 /**
7048 * Fetch the search results
0 commit comments