apexcharts/ng-apexcharts

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

Closed this issue · 6 comments

//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...

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

same error, the solution of tguimmaraess is not working

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

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

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],
})

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.