title: How to use await/async in ngOnInit?
body: <p>I am trying to call a function in the <strong><code>ngOnInit()</code></strong> and feed it two values. So this is the function I'm trying to call inside the <code>ngOnInit</code>: 
  <code>this.complexWordIdentification(this.postIWant, this.theHardWords);</code> </p>
  
  <p>The issue here is that <code>this.postIWant</code> and <code>this.theHardWords</code> are getting resolved in the <code>ngOnInit</code> itself as you can see below, which is causing the error. Now how can I call the <strong><code>this.complexWordIdentification(this.postIWant, this.theHardWords);</code></strong> and feed it those values without getting an error? </p>
  
  <p>I have been thinking about the await functions? But I can not figure it out, any advice on this, please?</p>
  
  <p>This is my <code>ngOnInit</code>: </p>
  
  <pre><code>ngOnInit() {
      this.isLoading = true;
      this.wordsLoaded = false;
      this.postLoaded = false;
      this.form = new FormGroup({
        annotation: new FormControl(null, {
          validators: [
            Validators.required,
            Validators.minLength(8),
            Validators.maxLength(250)
          ]
        })
      });
      this.id = this.route.snapshot.paramMap.get('postId');
      this.annotationService.getWords();
      this.annotationSub = this.annotationService
        .getWordUpdateListener()
        .subscribe((thewords: ComplexWord[]) =&gt; {
          this.thewords = thewords;
          this.thewords.map(word =&gt; {
            this.theHardWords.push(word.word);
            this.wordWithAnnotation.push(word);
          });
          this.wordsLoaded = true;
          this.isLoading = this.postLoaded &amp;&amp; this.wordsLoaded;
        });
      this.postsService.getPosts();
      this.postsSub = this.postsService
        .getPostUpdateListener()
        .subscribe((posts: Post[]) =&gt; {
          this.posts = posts;
          this.posts.map(post =&gt; {
            if (post.id === this.id) {
              this.postIWant = post.fileText;
            }
          });
          this.postLoaded = true;
          this.isLoading = !(this.postLoaded &amp;&amp; this.wordsLoaded);
        });
      this.role = this.authService.getUserRole();
      this.userIsAuthenticated = this.authService.getIsAuth();
      this.authStatus = this.authService
        .getAuthStatus()
        .subscribe(isAuthenticated =&gt; {
          this.userIsAuthenticated = isAuthenticated;
          this.role = this.authService.getUserRole();
        });
  }
  </code></pre>
  
  <p>If anyone can point me in the right direction it would be great, as I am not too experienced in this field. Currently I am having to call <code>this.complexWordIdentification(this.postIWant, this.theHardWords);</code> outside of the <code>ngOnInit</code> to avoid the error but obviously, I would like to call it automatically.</p>