@banana6boom/ngx-ssr-platform
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@banana6boom/ngx-ssr-platform

Add 14+ Angular support

Fork of @ngx-ssr/platform

Install package

npm i @banana6boom/ngx-ssr-platform

To determine the platform, use the tokens IS_SERVER_PLATFORM and IS_BROWSER_PLATFORM

@Directive({
  selector: '[some-directive]',
})
export class SomeDirective {
  constructor(@Inject(IS_SERVER_PLATFORM) isServer: boolean) {
    if (isServer) {
      viewContainer.createEmbeddedView(templateRef);
    }
  }
}

Use the ifIsServer and ifIsBrowser structural directives in your template for rendering contents depending on the platform:

@Component({
  selector: 'ram-root',
  template: '<some-сomp *ifIsServer"></some-сomp>',
  styleUrls: ['./app.component.less'],
})
export class AppComponent {}

Package Sidebar

Install

npm i @banana6boom/ngx-ssr-platform

Weekly Downloads

2

Version

1.0.4

License

none

Unpacked Size

35.4 kB

Total Files

17

Last publish

Collaborators

  • banana6boom