colapdev / ngx-britecharts

@colap-dev/ngx-britecharts is an Angular2 library for creating and displaying Britecharts charts (https://github.com/eventbrite/britecharts/) in your web application using D3.js v4. Checkout the demo: https://colapdev.github.io/ngx-britecharts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does it work with the new major NG releases?

tommiv opened this issue · comments

I'm using angular v5 and this code

import {
  BarChartModule,
} from '@colap-dev/ngx-britecharts/dist';

@NgModule({
  bootstrap: [Components.Core],
  imports:   [
    ...
    BarChartModule,
    RouterModule.forRoot(routes),
  ],
  providers: [
    ...
  ],
  declarations: [
    ...
  ],
})
export default class CoreModule { }

causes a startup exception:

Uncaught Error: Unexpected value 'BarChartModule' imported by the module 'CoreModule'. Please add a @NgModule annotation.
    at syntaxError (vendor.js:84678)
    at vendor.js:99301
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (vendor.js:99284)
    at JitCompiler._loadModules (vendor.js:117713)
    at JitCompiler._compileModuleAndComponents (vendor.js:117674)
    at JitCompiler.compileModuleAsync (vendor.js:117590)
    at CompilerImpl.compileModuleAsync (vendor.js:118834)
    at PlatformRef.bootstrapModule (vendor.js:5803)
    at Object.795 (boot.js:10567)

Calling BarChartModule.forRoot(), causes a similar error with different unexpected type:

Uncaught Error: Unexpected value '[object Object]' imported by the module 'CoreModule'. Please add a @NgModule annotation.
    at syntaxError (vendor.js:84678)
    at vendor.js:99301
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (vendor.js:99284)
    at JitCompiler._loadModules (vendor.js:117713)
    at JitCompiler._compileModuleAndComponents (vendor.js:117674)
    at JitCompiler.compileModuleAsync (vendor.js:117590)
    at CompilerImpl.compileModuleAsync (vendor.js:118834)
    at PlatformRef.bootstrapModule (vendor.js:5803)
    at Object.795 (boot.js:10567)

Hi @tommiv. Angular 5 isn't supported for the moment. We plan to do it but first we wanted to implement all the visualizations that Britecharts has to offer.

It shouldn't be difficult to add support for Angular 5. If you give me some days I may look into this issue and prioritize that.

Any news on this? Have you already tried to make it work with Angular 5/6?

Hi @saberone, I didn't worked on this because I never got an answer from OP. If you need it I can give it a shot.

I'm sorry, I've abandoned this ticket because I needed to start my work immeditately. So I just switched to another library without even ng bindings.

Ok, no problem @tommiv! Thanks for the update!

I built the demos using all Angular versions (2, 4, 5, 6).
All but Angular 5 are working (you can check the demos here). I'll check whats wrong with Angular 5 before this weekend.

Oh wow, that’s odd. Thx @martinmanzo for researching. I basically copied you’re Brush
Component and replaced the “require” statements with using normal Typescript imports. That works.

I see, I'll change that and test with the different Angular versions. If that work I'll release a new version. Thanks for the research!

Hi @saberone! Just updated the demos to work with the changes and the package to version 0.5.7. Let me know if this worked so I can close the issue. Thanks!