title: Angular Pagination, Get Current Page number
body: <p>I am trying to get current page in pagination. This the code in app.component.html:</p>
  
  <pre><code>&lt;ngb-pagination  [collectionSize]="500" [(page)]="page" (click)="showPageIndex(page)" aria-label="Default pagination" &gt;&lt;/ngb-pagination&gt;
  
  &lt;p&gt;current page is {{page}}&lt;/p&gt;
  </code></pre>
  
  <p>in app.component.ts:</p>
  
  <pre><code>public page = 1;
  
  
     showPageIndex(pageIndex){
       this.page = pageIndex;
       console.log(this.page);
     }
  </code></pre>
  
  <p>When I click on the page (say page 12), I am getting the result as '1'. When, I click again, I am getting the result as '12' (correct one).</p>
  
  <p>However, <p>current page is {{page}}</p>, is displaying the correct page.</p>
  
  <p>It seems that when the onclick is triggered, it gets the value of the current page (not the one after the click is done).</p>
  
  <p>Is something wrong with this approach? Should, I write the code for pagination manually in this case, instead of using a library?</p>
  
  <p>Appreciate your support.</p>
  
  <p>Thanks,</p>