angular - how to pass RouteData via Router.navigate in angular2 -
is there api in agnular2 allows passing json objects instead of string values . e.g. in router.navigate()
can pass route parameters
router.navigate('routename',[{key:stringvalue}])
and can retrieve using routeparams.get(key) : string
. returns string values. need pass json object.
appreciate pointers
i think it's not possible out of box since routing relies on urls , both path variables , query parameters strings. both routerparams
, routerdata
supports string attributes.
to simulate this, don't see other solutions encoding json objects using json.stringify
, parsing them on other side.
here plunkr describing this: https://plnkr.co/edit/jbl7v5fhqemf4f8tpxdo?p=preview.
hope helps you, thierry
Comments
Post a Comment