/** Angular Imports */ import { Injectable } from '@angular/core' ; import { Resolve , ActivatedRouteSnapshot } from '@angular/router' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /** Custom Services */ import { SearchService } from './search.service' ; /**
 * Search Results data resolver.
 */ @ Injectable ( ) export class SearchResolver implements Resolve < Object > { param { SearchService } searchService constructor ( private searchService ) { } param { ActivatedRouteSnapshot } route returns { Observable < any > } resolve ( route ) { const query = route . queryParams [ 'query' ] ; const resource = route . queryParams [ 'resource' ] ; return this . searchService . getSearchResults ( query , resource ) ; } }