title: How to delay an observable in Angular 6 / Typescript
body: <p>I have the following method <code>GetCurrentUserDelayedTest</code> that i wanted to put a delay on. I have left the original implementation here <code>GetCurrentUser</code> to demonstrate how i was originally using it:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Observable, of } from 'rxjs';
  import { User } from '../models/user';
  
  export class UserService {
  
      // Normal method without delay
      public GetCurrentUser(): Observable&lt;User&gt;
      {
          return of(new User(""));
      }
  
      // Method with delay attempt at code
      public GetCurrentUserDelayedTest(): Observable&lt;User&gt;
      {
          var observable = new Observable&lt;User&gt;((observable) =&gt; {
              setTimeout(() =&gt; {
                  return observable.complete();
              }, 2000);
          });
  
          observable.subscribe(() =&gt; {
              return of(new User(""));
          });
  
          return observable;
      }
  }
  </code></pre>
  
  <p>I'm trying to delay the method from returning its data by 2 seconds.</p>
  
  <p>What am i doing wrong? I'm brand new to angular 6 and typescript.</p>
  
  <p>I'm calling it like this:</p>
  
  <pre><code>this.userService.GetCurrentUserDelayedTest()
      .subscribe((currentUser) =&gt; {
          this.loadingGameState = false;
      });
  </code></pre>
  
  <p>The "Loading App" part remains on screen (no errors are thrown) rather than updating the view to show "Welcome"</p>
  
  <pre><code>&lt;div *ngIf="loadingGameState"&gt;Loading App&lt;/div&gt;
  &lt;div *ngIf="!loadingGameState"&gt;
    Welcome
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Ko9Y8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ko9Y8.png" alt="enter image description here"></a></p>
  
  <p>Argument of type 'Promise' is not assignable to parameter of type 'OperatorFunction'.
    Type 'Promise' provides no match for the signature '(source: Observable): Observable'.</p>