splunk
splunk

Reputation: 6779

include d3.js into angular2 project

I'm trying to use d3.js library in a MEAN application using angular2.

This is what I've done:

npm install d3
tsd install d3

In mypage.ts (where I want to display the d3.js graph)

// <reference path="../../../typings/d3/d3.d.ts" />
import * as d3 from "d3/d3";

But I get this error: error TS2307: Cannot find module 'd3/d3'.

My typings folder structure:

typings
- d3
    d3.d.ts
- index.d.ts

index.d.ts looks like:

/// <reference path="modules/d3/d3.d.ts" />

Upvotes: 1

Views: 1759

Answers (1)

Savaratkar
Savaratkar

Reputation: 2074

I stuck =somewhere else in D3 with Angular2, my search for the solution lead me here. It worked for me this way:

import * as d3 from 'd3';

See if it works for you as well.

Upvotes: 3

Related Questions