Using Ui-Router In Angular1 The stateparam value is coming using $state.params
How to do the same thing in ANgular2
I tried like this this._uiRouter.globals.params.id
it's working, But its not a proper solution, even I am using webstrome editor, the editor also showing error like TS2339 Property id does not exits on typeStateParams,
Please help me do proper way
you can get state parameters from the Transition exportable object while configuring URL state:
then in you component code:
modified plunker from the https://ui-router.github.io/tutorial/ng2/hellosolarsystem#live-demo: https://plnkr.co/edit/IVGx0p9lQr1yKqgwZT4X
pay attention to 2 files:
These days it's simpeler. In your constructor inject this:
You can then access the params via this variable: