alhazmy13 / angular-csv-ext

Helper library for create CSV file in Angular.
MIT License
45 stars 23 forks source link

NPM is screwed up? Getting test data in download #13

Closed colmben closed 6 years ago

colmben commented 6 years ago

Hi,

It looks like your index.js in the NPM module is currently set to be your test example, as follows:

const Angular5Csv = require('./dist/Angular5-csv.js').Angular5Csv;

const data = [
    {
        name: "Test 1",
        age: 13,
        average: 8.2,
        approved: true,
        description: "using 'Content here, content here' "
    },
    {
        name: 'Test 2',
        age: 11,
        average: 8.2,
        approved: true,
        description: "using 'Content here, content here' "
    },
    {
        name: 'Test 4',
        age: 10,
        average: 8.2,
        approved: true,
        description: "using 'Content here, content here' "
    },
];

new Angular5Csv(data, 'My Report');

So any call to the library is just downloading that test data! A bit of showstopper...

colmben commented 6 years ago

Yikes, my fault, you need to take the import from the readme which links directly to the js file, rather than just importing the directory as you normally would.

import { Angular5Csv } from 'angular5-csv/Angular5-csv';