I have a Router Configuration for my angular2 app.
Here is the code
import { provideRouter, RouterConfig } from '@angular/router';
import { HomeComponent } from "./home.component";
const routes: RouterConfig = [ // I want this data by api call,
{ path: 'home', component: HomeComponent }
{ path: '', redirectTo: '/home', pathMatch: 'full' }
];
export const appRouterProviders = [
provideRouter(routes)
];
I want my data to get from database from mongodb. I have already setup the database and through an api call
http://localhost:3000/getAppRoutes
it is already returning data in below format, means array of objects,
[
{ path: 'home', component: HomeComponent }
{ path: '', redirectTo: '/home', pathMatch: 'full' }
]
How do I fetch data from database but not as static configurations ?
Thanks