0

How to initialize an Angular2 componenet after going through a _router.navigation?

I mean I want to go to component without refreshing the browser but trigger the onChange function or the init function of the component to have the initial config of my variables.

let link = ["componant/" + id+ "/sub/"+id]

this._router.navigate(link)
acdcjunior
  • 132,397
  • 37
  • 331
  • 304
imtah
  • 409
  • 1
  • 6
  • 16
  • Please create a [Minimal, Complete, and Verifiable Example](http://stackoverflow.com/help/mcve) – Andrei Zhytkevich Aug 04 '16 at 14:52
  • Hello Andrei, I just add the minimal code. – imtah Aug 04 '16 at 14:56
  • You can subscribe to router events to know when the route changed http://stackoverflow.com/questions/37977428/how-to-use-new-navigationstart-angular-router-3-0-0-alpha/37983781#37983781 or subscribe to route params change http://stackoverflow.com/questions/38712528/how-to-pass-parameters-to-routes-in-angular2-0 – Günter Zöchbauer Aug 04 '16 at 15:00

0 Answers0