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

Ionic component styles not loading with Angular SSR

Discussão em 'Angular' iniciado por Suresh Kumar, Outubro 11, 2024.

  1. Suresh Kumar

    Suresh Kumar Guest

    I'm using Angular 18 standalone application with Ionic 8 and enabled server side rendering. When I try to run SSR, the styles of ionic components are not loading. It just loads the plain html. [​IMG]

    server.ts:

    commonEngine
    .render({
    bootstrap,
    documentFilePath: indexHtml,
    url: `${protocol}://${headers.host}${originalUrl}`,
    publicPath: distFolder,
    inlineCriticalCss: false,
    providers: [
    { provide: APP_BASE_HREF, useValue: req.baseUrl },
    { provide: 'REQUEST', useValue: req },
    { provide: 'RESPONSE', useValue: res }
    ]
    })
    .then((html) => {
    // Inietta dinamicamente il CSS nel contenuto HTML generato
    if (cssFileName) {
    html = html.replace(
    '</head>',
    `<link rel="stylesheet" href="${cssFileName}"></head>`
    );
    }
    res.send(html);
    })
    .catch((err) => next(err));
    });

    Continue reading...

Compartilhe esta Página