Now Paging Maciej

    angular2-csv2json
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    angular2-csv2json

    Installation

    npm i angular2-csv2json --save

    Usage

    In your module.ts,

    import { CSV2JSONModule } from 'angular2-csv2json';
    

    Then import it into your @NgModule

    @NgModule({
      ..
      imports: [
        CSV2JSONModule
      ],..
    })
    

    in your .html,

     <csv2json 
        [btnText]="'custom text in button. '"
        [errorMsg]="'custom error msg'"
        (response)='onUpload($event)'
     ></csv2json>
    
    • Default btnText is 'Upload'.
    • Default errorMsg is 'Invalid format. Please upload only csv files..';

    in your .ts,

    onUpload(event: {type: string, data: any}) {
      if (event.type === 'success') {
        console.log(event.data);
      } else { 
        console.log(event.data); // error
      }
    }
    

    License

    MIT © Prithivraj200

    Install

    npm i angular2-csv2json

    DownloadsWeekly Downloads

    6

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    23.1 kB

    Total Files

    8

    Last publish

    Collaborators

    • prithivraj200