My routes are defined as:
export const routes: Routes = [
{ path: "", redirectTo: "/datasets", pathMatch: "full" },
{
path: "help/youtube",
canActivate: [RedirectGuard],
component: RedirectGuard,
data: {
externalUrl: "https://youtube.com"
}
},
...
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}
Where redirect guard is a module that handles external URLs.
Instead of hard coding externalUrl I need to fetch it from my appConfig but I cant access appConfig without a constructor like:
constructor(@Inject(APP_CONFIG) private appConfig) {}
as appConfig is set up as a module with injection token like:
export const APP_CONFIG = new InjectionToken<AppConfig>("app.config");
So i tried to add this Inject to my AppRoutingModule but to no success.
How can I access appConfig to populate this external URL?