title: UI Router and query parameters
body: <p>I built a small search app using Angular, UI Router and Elasticsearch and I'm trying to get UI Router query parameters in the url on the results page.</p>
  
  <p>I'm trying to achieve this</p>
  
  <pre><code>domain.com/search?user_search_terms
  </code></pre>
  
  <p>with this</p>
  
  <pre><code>.state('search', {
          url: '/search?q',
  </code></pre>
  
  <p>and I init searchTerms and $stateParams like this in my controller</p>
  
  <pre><code>vm.searchTerms = $stateParams.q || '';
  </code></pre>
  
  <p>and then in my search function in my controller I have this</p>
  
  <pre><code> vm.search = function() {
            $state.go('search', {q: vm.searchTerms});
  ...
  </code></pre>
  
  <p>Everything works fine, until I try to implement the UI Route query parameters. I can still get search suggestions, transition from state to state but search breaks.</p>
  
  <p>I thought I needed to implement Angular $http get params within a config {}, but then I realized I'm JUST trying to get query parameters using UI Router. It seems I have everything setup right with UI Router to get query parameters but ... what am I doing wrong?</p>