Created
August 9, 2016 18:07
-
-
Save brandonroberts/43f32d91e1f8348f3955c870ba823a07 to your computer and use it in GitHub Desktop.
Gather route components for declarations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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