I'm trying to use ng2-nvd3 (https://github.com/krispo/ng2-nvd3) in an Angular2 project (core v2.1.1) but it's not working.
I've put nvD3 in the declarations in my @MgModule:
declarations: [
...
TestComponent,
nvD3,
],
and I've set up the component as described:
import {Component} from '@angular/core';
import {nvD3} from 'ng2-nvd3';
declare let d3:any;
@Component({
template: '<div><nvd3 [options]="options" [data]="data"></nvd3></div>'
})
export class TestComponent {
options;
data;
ngOnInit(){
this.options = {
chart: {
type: 'discreteBarChart',
height: 450,
margin : {
...
but I get the error:
EXCEPTION: Uncaught (in promise): Error: Error in ./TestComponent class TestComponent - inline template:0:31 caused by: nv is not defined
I've got nvd3 and d3 in my package.json file but I'm not sure what I should be doing with them.