apexcharts / ng-apexcharts

ng-apexcharts is an implementation of apexcharts for angular. It comes with one simple component that enables you to use apexcharts in an angular project.
MIT License
310 stars 78 forks source link

Any idea for 'apx-chart' is not a known element? #206

Open MarvinWang opened 2 years ago

MarvinWang commented 2 years ago

//My env. Angular版本:V12 Angular CLI: 12.2.17 Node: 14.17.3 Package Manager: npm 6.14.13 OS: darwin x64 Typescript:4.3.5 IDE Tool:Visual Studio Code

when I followed the steps one, two, three for downloading and installing Apexcharts, I got an error under the ' 'tag in the *.component.html like ..

image

pls tell me how to resolve this issue...

tguimmaraess commented 2 years ago

You need to import NgApexchartsModule in your app.modules.ts file and then, in @NgModules, in your imports, import the NgApexchartModule

import { NgApexchartsModule } from "ng-apexcharts"

@NgModule({  
  ......

  imports: [
    NgApexchartsModule
  ]
})
Noext commented 2 years ago

same error, the solution of tguimmaraess is not working

tguimmaraess commented 2 years ago

same error, the solution of tguimmaraess is not working

Could you provide a repository or a link to https://stackblitz.com/?

Here's an example: https://stackblitz.com/edit/angular-ivy-agzta9?file=src/app/app.component.html, https://angular-ivy-agzta9.stackblitz.io

By the way, it's apx-chart not apex-chart

billygerhard commented 2 years ago

I got it working by importing directly into the individual page modules, not into my app.module.ts

benboughton1 commented 1 year ago

I spent too long on this one.

For me, I jumped the gun and had not declared the component that I was using ngApexChartsModule. Once declared, it all worked as it should... This problem doesn't show up on the stackblitz examples as it is all contained in one module and component.

E.g. if for using ScatterComponent in a page called Fields:

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    FieldsPageRoutingModule,
    NgApexchartsModule
  ],
  declarations: [FieldsPage, ScatterComponent],
})