title: ngAfterViewInit is not working or am I doing something wrong
body: <p>My ngAfterViewInit function is not working as expected. I have feeling that I am missing something here.</p>
  
  <pre><code>  ngOnInit() {
     this.dataService.getUsers().subscribe((users) =&gt; {this.users = users) ;  
    }
  
    ngAfterViewInit() {
      if (document.getElementById('target')) {
          document.getElementById('target').scrollIntoView({
            behavior: 'auto',
            block: 'center',
            inline: 'center',
         });
     }
  </code></pre>
  
  <p>So basically, I'm using <code>ngAfterViewInint()</code> function to scroll to the current item, after the view complete loaded. Inside <code>ngOnInit()</code>, if I am not calling <code>subscribe()</code> and just put a variable there. It works just fine. But its not the case that what i am asking.</p>
  
  <p>I have a work around by using <code>setTimeOut()</code> inside <code>ngAfterViewInit()</code>. But I don't like it. I dont like the fact that its relies on timeout. And I think there would be a better solution for it. 
  Any ideal ? Thanks all.</p>