1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

angular app_initalizer didn't execute

Discussão em 'Angular' iniciado por ucef, Setembro 17, 2025.

  1. ucef

    ucef Guest

    i want to do some initialization and have a return of an obesrvable before my app start, so i write this code and put it in the app.module

    function initializeApp(authService: AuthService) {
    return () => authService.getUtilisateurConnecte();
    }


    `

    providers: [
    ...
    {
    provide: APP_INITIALIZER,
    multi: true,
    useFactory: initializeApp,
    deps: [AuthService],
    },
    ],`


    and the following is the function of authService

    public getUtilisateurConnecte() { return new Promise(() => this.domiaGroupUserService.currentUser$).then((user: DomiarefUser) => { console.log('conected user ' + user?.given_name); });; }

    but the inititialisation didn't complete and so the app didn't start. how can i handle this initialisation

    Continue reading...

Compartilhe esta Página