title: Cannot read property 'unsubscribe' of undefined (rxJS - Subscription)
body: <p>I am trying to get a grip of subscriptions and observables in rxJS. </p>
  
  <p>I want to change the interval of an Observable by unsubscribing and then resubscribe using the new interval setting.</p>
  
  <p>Should be really simple but since I'm a beginner in this area I could need some assistance.  </p>
  
  <p>See this <a href="https://plnkr.co/edit/AcT2hd" rel="nofollow">plunk</a></p>
  
  <pre><code>export class AppComponent implements OnInit {
    title = 'Observable Interval - Changing interval';
    currentTime: any;
    refreshInterval: number = 1000;
    private subscription: Subscription;
  
    constructor(private timeService: TimeService) {
    }
  
    clicked($event) {
      console.log('new refreshInterval: ' + this.refreshInterval);
  
      // Here I would like to unsubscribe to the subscription 
      // and then resubscribe using the new interval. 
      // However using below statement causes a 
      // TypeError: Cannot read property 'unsubscribe' of undefined
      this.subscription.unsubscribe();
      this.getTime();
    }
  
    // with this implementation changing the refreshInterval won't have any affect. 
    getTime() {
              this.timeService.getTime(this.refreshInterval)
                .subscribe(t =&gt; {
                  this.currentTime = t;
                }
              );
      }
  
    ngOnInit() {
      this.subscription = this.getTime();
      console.log(this.subscription);
      console.log('refreshing each ' + this.refreshInterval + ' ms');
    }
  }
  </code></pre>