Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

SSR error, add isBrowser check for share buttons #56

Closed
maxsv0 opened this issue Sep 1, 2019 · 0 comments
Closed

SSR error, add isBrowser check for share buttons #56

maxsv0 opened this issue Sep 1, 2019 · 0 comments
Assignees

Comments

@maxsv0
Copy link
Owner

maxsv0 commented Sep 1, 2019

Error in ngx-sharebuttons usage.

->share.component.ts
import {Component, Inject, OnInit, PLATFORM_ID} from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
....
export class ShareComponent implements OnInit{
isBrowser;
....
constructor(@Inject(PLATFORM_ID) private platformId: Object) { }

ngOnInit() {
    this.isBrowser = isPlatformBrowser(this.platformId);
    .....
 
  }
 ....
}
->share.component.html
<div class="..." *ngIf="isBrowser">
        <share-buttons show="5"></share-buttons>
 </div>
@maxsv0 maxsv0 self-assigned this Sep 1, 2019
@maxsv0 maxsv0 closed this as completed in 85843bf Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant