title: Nativescript angular 2 call Function On page load every time
body: <p>I want to execute a piece of code every time a new the page in navigated to. I am using the <code>&lt;page-router-outlet&gt;</code>.</p>
  
  <p>As mention <a href="https://docs.nativescript.org/angular/core-concepts/angular-navigation.html#lifecycle-hooks-and-component-caching" rel="nofollow noreferrer">here</a>, while using page-router-outlet the component is cached. So when it is navigated back into view no <code>Init</code> lifecycle events of angular 2 are executed.</p>
  
  <p>I tied using just the , which does not cache the component and as a result call the <code>Init</code> Lifecycle events. But using it exits the app when I press the Hardware back button.</p>