@ngx-ssr/platform
Version:
Install package
38 lines (31 loc) • 714 B
Markdown
# -ssr/platform
Install package
```bash
npm i -ssr/platform
```
To determine the platform, use the tokens `IS_SERVER_PLATFORM` and `IS_BROWSER_PLATFORM`
```ts
export class SomeDirective {
constructor(
isServer: boolean,
) {
if (isServer) {
viewContainer.createEmbeddedView(templateRef);
}
}
}
```
Use the `ifIsServer` and ` ifIsBrowser` structural directives in your template for rendering contents depending on the
platform:
```ts
export class AppComponent {
}
```