Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billboard.js 3.5.1 with angular 6.0 gives ERROR TypeError: t.hasType is not a function when ng serve --prod #2885

Closed
flocheke7 opened this issue Oct 3, 2022 Discussed in #2883 · 4 comments

Comments

@flocheke7
Copy link

Discussed in #2883

Originally posted by flocheke7 September 30, 2022
I try to use Billboard.js 3.5.1 with an angular6.0 application
when i run with ng serve , application works fine.
when I run with ng serve --prod, application gives the following error when application gerenates chart (bb.generate)

main.19bd664034f5a0e96060.js:formatted:7402 ERROR TypeError: t.hasType is not a function at main.19bd664034f5a0e96060.js:formatted:66053:39 at e.init (main.19bd664034f5a0e96060.js:formatted:66067:22) at new e (main.19bd664034f5a0e96060.js:formatted:66471:23) at Object.generate (main.19bd664034f5a0e96060.js:formatted:69686:29) at e.ngAfterViewInit (main.19bd664034f5a0e96060.js:formatted:139959:35) at fa (main.19bd664034f5a0e96060.js:formatted:11674:55) at ha (main.19bd664034f5a0e96060.js:formatted:11662:36) at da (main.19bd664034f5a0e96060.js:formatted:11655:60) at Pa

can i use billboard 3.5.1 with angular 6 ?

@netil
Copy link
Member

netil commented Oct 4, 2022

Hi @flocheke7, it seems duplication with #2855
Could you try with the new released v3.6?

@netil netil added duplicate question type.d Type definition related labels Oct 4, 2022
@flocheke7
Copy link
Author

I still have the same problem with v3.6

@netil netil added need-investigate practical and removed type.d Type definition related labels Oct 4, 2022
@netil
Copy link
Member

netil commented Oct 7, 2022

@flocheke7, looks like having issue importing & compiling pure ESM from Angular 6.
Try importing CJS dist file as below example.

BTW, tested on latest Angular 14 also and worked without issue.

import { Component, OnInit } from '@angular/core';
import bb from "billboard.js/dist/billboard.js";

@Component({
  selector: 'app-chart',
  templateUrl: './chart.component.html',
  styleUrls: ['./chart.component.css']
})
export class ChartComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    bb.generate({
      data: {
        columns: [
          ["data1", 30, 200, 100, 400, 150, 250],
          ["data2", 50, 20, 10, 40, 15, 25]
        ],
        type: "bar"
      },
      bindto: "#chart"
    });
  }
}

image

@netil
Copy link
Member

netil commented Oct 19, 2022

Closing the issue.
@flocheke7 let me know if has more issue.

@netil netil closed this as completed Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants