Angular CLI ng serve with --base-href - I do not understand its behavior

Discussão em 'Angular' iniciado por Ang, Janeiro 20, 2025.

  1. Ang

    Ang Guest

    I am new in Angular CLI. I am writing an new app, and in the index.html I insert base href, for example - <base href="/a/">.

    When I useng serve and go to localhost:4200/a (or even localhost:4200) I see a white screen, but when I use ng serve --base-href /a/ I see my app in localhost:4200, in localhost:4200/a, and actually in every url that starts with localhost:4200 for example localhost:4200/aaaaaaa.

    I do not understand this behavior.

    From the documentation I understood that this flag just change the base href in index html, but I already have this base href in my index.html so why my app doesn't work just with ng serve in localhost:4200/a?

    And why when I use ng serve --base-href /a/ it is not working ONLY at localhost:4200/a? what do I miss? I am really confused.

    Thanks!

    Continue reading...

Compartilhe esta Página