title: How to access queryParams in a Resolver Angular
body: <p>I Need to implement 'search' by passing queryParams through route from the search component to the userList component (example. /search-result?user="Alfred"). Before loading the userList component, i need to make an API call using the queryParams in the userList resolver but the query params keeps showing undefined.</p>
  
  <p><strong>Search Component</strong></p>
  
  <pre><code>search(searchTerm: string) {
      if (searchTerm) {
        this.router.navigate(['search-result'], { queryParams: { user: searchTerm } });
    }
  }
  </code></pre>
  
  <p><strong>UserList Resolver</strong></p>
  
  <pre><code>export class UserResolver implements Resolve&lt;User[]&gt; {
    constructor(private userService: UserService, private route: ActivatedRoute) { }
  
    resolve(): Observable&lt;User[]&gt; {
      const searchTerm: string = this.route.snapshot.queryParams['user'];
      console.log(searchTerm); //Logs Undefined
  
      return this.userService.getUsers(searchTerm);
    }
  }
  </code></pre>