Working on Routing in angular2. actually i know we can send key/value using RouteParams in the routing but i want to send whole object/array in the RouteParams, i don\'t k
You can pass Objects to Url's in Angular2, but it's not really supported. The get-Method on routeParams only returns a string-representation, so you would get a string like "[Object]". If you want to access the passed data, you need to use the params-Property:
constructor(@Inject(RouteParams) params:RouteParams, @Inject(Http) http:Http){
this.data= params.params.data;
}
But beware, this only works properly the first time you call the route.
If you call the route anothertime with different data, it can happen that params.params.data
returns your old data although you put new data into the route.