I am trying to pass JSON on routing URL here is my
app.route.ts code
{path: 'calculator', component: CalculatorComponent,data : {some_data : null}},
and my code to route the data is
this.router.navigate(['/home/calculator', {some_data:this.loanData}]);
and the calculator.ts have the oninit method code is like this
import {ActivatedRoute} from '@angular/router';
constructor(private route: ActivatedRoute) {}
sub
ngOnInit() {
this.sub = this.route
.data
.subscribe(v => console.log(v));
}
output is like this
{"some_data":null}
the problem is it's not showing the json, I passed from the ts first component
$router.current.paramsor$routeParamsif you want to grab these values in the router, as described on AngularjS documentation