I cannot wrap my head around how i can import d3js library in a ionic typescript projet. I installed the library using :
npm install d3 --save-dev
The library is in node_modules/d3. In my page modules, I try to import using every possible path, for example :
import * as d3 from 'd3/d3'
import * as d3 from '../../../node_modules/d3/d3'
I always get the error:
Error TS2307: Cannot find module 'd3/d3'.
or
Error TS2307: Cannot find module '../../../node_modules/d3/d3'`.
Any hint to help me ?
Angular version 2.0.0-rc.1
Ionic : 2.0.0-beta.9
Thanks
I used a workaround the issue.
What I did :
Link d3js in the index.html (at the end of the file, bellow app.bundle.js):
<script src="https://d3js.org/d3.v3.min.js"></script>
Then in my page.ts (before @Component) :
declare var d3: any;
And then you can use it like :
d3.select("#graph svg").remove();
So I am not using import (you should delete the import if you want to use this solution)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.