Size: a a a

Angular-universal-ru

2021 June 07

S

Shivi in Angular-universal-ru
Yes
источник
2021 June 08

S

Shivi in Angular-universal-ru
I got one issue in angular universal please help
I)I am sucessfully able to install angular universal
2)I am sucessfully able to build it using npm run build:ssr
3)but after npm run serve:ssr
I got one error document is not defined
источник

S

Shivi in Angular-universal-ru
This is the error
источник

S

Shivi in Angular-universal-ru
Anyone know about this please help
источник

DL

Dmitriy Limonov in Angular-universal-ru
There is no global variables available for universal, like window or document
источник

S

Shivi in Angular-universal-ru
Ok so what I can do get rid of this issue
источник

DL

Dmitriy Limonov in Angular-universal-ru
You should probably wrap your document call with isPlatformBrowser method
источник

DL

Dmitriy Limonov in Angular-universal-ru
If you need the document object on your prerender state, there is another way
источник

ИК

Игорь Кацуба... in Angular-universal-ru
источник

DL

Dmitriy Limonov in Angular-universal-ru
источник

DL

Dmitriy Limonov in Angular-universal-ru
Take a look at our server.ts as well, we can use window and document objects by using domino library https://github.com/rovergulf/ngx-slice-kit/blob/main/server.ts
источник

S

Shivi in Angular-universal-ru
Which one
источник

DL

Dmitriy Limonov in Angular-universal-ru
A message right above
источник

S

Shivi in Angular-universal-ru
This
источник

DL

Dmitriy Limonov in Angular-universal-ru
And my github link
источник

S

Shivi in Angular-universal-ru
Ok
источник

DL

Dmitriy Limonov in Angular-universal-ru
Sure those both would help you
источник

S

Shivi in Angular-universal-ru
So do we need to write isplatform whereever we use document.getElm
источник

DL

Dmitriy Limonov in Angular-universal-ru
Better do
источник

DL

Dmitriy Limonov in Angular-universal-ru
As well you do better not to use document.getElem, and use Renderer class
источник