Skip to content

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

@johnvjs90

Description

@johnvjs90

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 angular2-csv@0.2.5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions