I'm trying to differentiate between the sample companies and other companies. So I'm passing query params to check if it is sample company and check the query param sample if it is true in Route array like this
const routes: Routes = [{ path: '',
component: DefaultComponent,
children: [
{path: 'company', redirectTo: 'company-data/1?sample=true'},
{path:'company/:id', component: CompanyComponent}
]}];
How can I read this query param in component and fetch true value for sample company and for other companies that sample will be false. I get undefined if I try to fetch it like this
this.route.queryParams.subscribe(params => {
console.log('Query params ',params['sample'])
});
I don't know if this is right way.