Skip to content

Instantly share code, notes, and snippets.

@brandonroberts
Created August 9, 2016 18:07
Show Gist options
  • Save brandonroberts/43f32d91e1f8348f3955c870ba823a07 to your computer and use it in GitHub Desktop.
Save brandonroberts/43f32d91e1f8348f3955c870ba823a07 to your computer and use it in GitHub Desktop.
Gather route components for declarations
import { Routes } from '@angular/router';
export function getRouteComponents(routes: Routes, routeComponents: any[] = []) {
routes.forEach(route => {
if (route.component) {
routeComponents.push(route.component);
}
if (route.children) {
getRouteComponents(route.children, routeComponents);
}
});
return routeComponents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment