title: Angular5 ParamMap and HttpClient
body: <p>How can I get ParamMap to work with the HttpClient via a service in Angular5?</p>
  
  <p>Component</p>
  
  <pre><code>// importing the service, ActivatedRoute, ParamMap, switchMap, etc
  
  public value;
  constructor(private myService: MyService, private activatedRouter: ActivatedRoute) { }
  
  ngOnInit() {
      this.value = this.activatedRouter.paramMap
      .switchMap((params: ParamMap) =&gt; this.myService.getOne(params.get('id')));
    }
  </code></pre>
  
  <p>Service</p>
  
  <pre><code>import { HttpClient } from '@angular/common/http';
  // ...
  constructor(private httpClient: HttpClient) { }
  getOne(id) {
      return this.httpClient.get(`http://my.api/${id}`);
    }
  </code></pre>
  
  <p>At the moment if I do <code>console.log(this.value)</code> in my component I get a <code>AnonymousSubject</code>.</p>
  
  <p>The question is, how can I use ParamMap and get the value from the HttpClient? I know I could use a router snapshot - which I have done and it works but I'd like to get this example working as well.</p>