title: How create observable with parameters in Angular 6?
body: <p>I want to create an observale which can pass some parameters in Angular 6. 
  Below is the sample code for creating observable in Angular site <a href="https://angular.io/guide/observables" rel="noreferrer">https://angular.io/guide/observables</a>, but it doesn't explain how to pass any parameters. </p>
  
  <pre><code>// Create an Observable that will start listening to geolocation updates
  // when a consumer subscribes.
  const locations = new Observable((observer) =&gt; {
    // Get the next and error callbacks. These will be passed in when
    // the consumer subscribes.
    const {next, error} = observer;
    let watchId;
  
    // Simple geolocation API check provides values to publish
    if ('geolocation' in navigator) {
      watchId = navigator.geolocation.watchPosition(next, error);
    } else {
      error('Geolocation not available');
    }
  
    // When the consumer unsubscribes, clean up data ready for next subscription.
    return {unsubscribe() { navigator.geolocation.clearWatch(watchId); }};
  });
  
  // Call subscribe() to start listening for updates.
  const locationsSubscription = locations.subscribe({
    next(position) { console.log('Current Position: ', position); },
    error(msg) { console.log('Error Getting Location: ', msg); }
  });
  
  // Stop listening for location after 10 seconds
  setTimeout(() =&gt; { locationsSubscription.unsubscribe(); }, 10000);
  </code></pre>
  
  <p>What I want is pass some parameters to observable when I subscribe it, I guess  the definition of observable may be looks like: </p>
  
  <pre><code>const myobservable(a, b) = new Observable((observer) =&gt; {
    ...
  })
  </code></pre>
  
  <p>Could you please tell how can I do that? </p>