Ich versuche, dynamische Routen Array für RouterModule zu erstellen. Wie in don't and do's erklärt, ich bin Export eine Funktion als meine Routen Array zu verwenden:Angular AOT: Funktionsaufrufe werden nicht unterstützt
export function DynamicRoutingCreation() {
let myRoutes;
// .. forEach loop to create dynamic array
}
und in meinem AppModule:
const APP_ROUTES: Routes = DynamicRoutingCreation();
...
RouterModule.forRoot(APP_ROUTES)
Aber ich erhalte immer diese Fehlermeldung:
Error ... Calling function 'DynamicRoutingCreation' , function calls are not supported. Consider replacing the function or lambda with a reference to an exported function.