(route: Route, fullPath: string, requireStandaloneComponents: boolean)
| 86 | } |
| 87 | |
| 88 | function validateNode(route: Route, fullPath: string, requireStandaloneComponents: boolean): void { |
| 89 | if (typeof ngDevMode === 'undefined' || ngDevMode) { |
| 90 | if (!route) { |
| 91 | throw new RuntimeError( |
| 92 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 93 | ` |
| 94 | Invalid configuration of route '${fullPath}': Encountered undefined route. |
| 95 | The reason might be an extra comma. |
| 96 | |
| 97 | Example: |
| 98 | const routes: Routes = [ |
| 99 | { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, |
| 100 | { path: 'dashboard', component: DashboardComponent },, << two commas |
| 101 | { path: 'detail/:id', component: HeroDetailComponent } |
| 102 | ]; |
| 103 | `, |
| 104 | ); |
| 105 | } |
| 106 | if (Array.isArray(route)) { |
| 107 | throw new RuntimeError( |
| 108 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 109 | `Invalid configuration of route '${fullPath}': Array cannot be specified`, |
| 110 | ); |
| 111 | } |
| 112 | if ( |
| 113 | !route.redirectTo && |
| 114 | !route.component && |
| 115 | !route.loadComponent && |
| 116 | !route.children && |
| 117 | !route.loadChildren && |
| 118 | route.outlet && |
| 119 | route.outlet !== PRIMARY_OUTLET |
| 120 | ) { |
| 121 | throw new RuntimeError( |
| 122 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 123 | `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`, |
| 124 | ); |
| 125 | } |
| 126 | if (route.redirectTo && route.children) { |
| 127 | throw new RuntimeError( |
| 128 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 129 | `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`, |
| 130 | ); |
| 131 | } |
| 132 | if (route.redirectTo && route.loadChildren) { |
| 133 | throw new RuntimeError( |
| 134 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 135 | `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`, |
| 136 | ); |
| 137 | } |
| 138 | if (route.children && route.loadChildren) { |
| 139 | throw new RuntimeError( |
| 140 | RuntimeErrorCode.INVALID_ROUTE_CONFIG, |
| 141 | `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`, |
| 142 | ); |
| 143 | } |
| 144 | if (route.component && route.loadComponent) { |
| 145 | throw new RuntimeError( |
no test coverage detected
searching dependent graphs…