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

Can't resolve all parameters for Angular2Csv: (?, ?, ?). #80

Open
johnvjs90 opened this issue Feb 19, 2019 · 0 comments
Open

Can't resolve all parameters for Angular2Csv: (?, ?, ?). #80

johnvjs90 opened this issue Feb 19, 2019 · 0 comments

Comments

@johnvjs90
Copy link

I have followed the steps given in the link https://www.npmjs.com/package/angular2-csv to export to csv file in angular 4 application in ASP.Net Core but getting the error "Can't resolve all parameters for Angular2Csv: (?, ?, ?)."

Please find below the steps which i have done,

Have installed the angular2-csv using npm

 npm install --save [email protected]

Then I have imported in app.module.server.ts

import { Angular2Csv } from 'angular2-csv';

and added the providers,

@NgModule({
declaration:[...],
imports:[...],
providers:[Angular2Csv]
})

Then I have created the options and data for exporting to csv

import { Angular2Csv } from 'angular2-csv';

@Component({
    selector: 'home',
    templateUrl: './my.component.html',
    styleUrls: ['./my.component.css'],
    encapsulation: ViewEncapsulation.None
})
export class MyComponent { 
options = {
    fieldSeparator: ',',
    quoteStrings: '"',
    decimalseparator: '.',
    showLabels: false,
    headers: [],
    showTitle: true,
    title: 'asfasf',
    useBom: false,
    removeNewLines: true,
    keys: ['approved','age','name' ]
  };
  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 3',
      age: 10,
      average: 8.2,
      approved: true,
      description: "using 'Content here, content here' "
    }
  ];
  } >

and my template looks like this

<angular2csv [data]="data" filename="test.csv" [options]="options"></angular2csv>

When I am building and running the solution, getting the below mentioned error

"Can't resolve all parameters for Angular2Csv: (?, ?, ?)"

Please help me in resolving this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant