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 know is it possible or not. is there any way to do so if not then any alternate who knows ?
my current HTML part is :
<div *ngFor="#books of getBooks_array #i=index">
<a [routerLink]="['/IssueBook', {name: books.book_name, isbn: books.book_ISBN,author: books.book_author, price: books.book_price, id: books.book_id, language: books.book_language}]"></a>
</div>
my current .ts conatins:
constructor(@Inject(RouteParams) params:RouteParams, @Inject(Http) http:Http){
this.name= params.get('name');
this.id= params.get('id');
this.language= params.get("language");
this.price= params.get("price");
this.author= params.get("price");
this.isbn= params.get("isbn");
}
but i want to send RouteParams like this :
<div *ngFor="#books of getBooks_array #i=index">
<a [routerLink]="['/IssueBook', {data: books}]">Books</a>
</div>
and i am trying to get data like this:
constructor(@Inject(RouteParams) params:RouteParams, @Inject(Http) http:Http){
this.data= params.get('data');
}
but i am getting error :