Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

NotYetImplemented ng2-chart angular 2

1- Create a boolean in your component .ts file and set its value like this

import { Inject, PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";

isBrowser: boolean;

constructor(@Inject(PLATFORM_ID) private platformId: unknown) {}

ngOnInit(): void {
    this.isBrowser = isPlatformBrowser(this.platformId);
}

2- Then in your HTML file use the ng2-charts HTML tag as below

<canvas *ngIf="isBrowser"
        baseChart
        ...
        ...
        ... >
</canvas>
 
PREVIOUS NEXT
Tagged: #NotYetImplemented #angular
ADD COMMENT
Topic
Name
6+5 =