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

How to Set Dynamic Base Href for Clientlib Generated Using Angular SPA in AEM?

Discussão em 'Angular' iniciado por Art3, Outubro 9, 2024.

  1. Art3

    Art3 Guest

    I'm trying to generate a clientlib for an Angular SPA in AEM using aem-clientlib-generator. By default, the baseHref (or deployUrl) for the resources folder in the clientlib is /etc.clientlibs/<proj-name>/clientlibs/clientlib-angular/resources.

    This works fine in the local AEM environment (http://localhost:4502/). However, in other environments, we have paths like /auth or /pub after the host URL, e.g., https://aem-dev-url/auth or https://aem-dev-url/pub.

    In these cases, the resources URL should become: https://aem-dev-url/auth/etc.clientlibs/<proj-name>/clientlibs/clientlib-angular/resources, depending on whether it's the auth or pub instance. How can I achieve this?

    I tried configuring APP_BASE_HREF dynamically based on the URL in app.module.ts, setting it to /auth or /pub, but this doesn't work for accessing the resources folder in the generated clientlib.

    How can I provide a dynamic base URL when generating the clientlib? Are there other methods to solve this?

    Versions used: AEM version - 6.5.20.0 Angular version - 13.4.0

    Continue reading...

Compartilhe esta Página