@qlee/ng-csv
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

NgCsv

Import Module

import { NgCsvModule } from '@qlee/ng-csv';

@NgModule({
  declarations: [],
  imports: [ NgCsvModule ],
  providers: [],
  bootstrap: []
})
export class AppModule { }

Upload csv

<button ngCsv (upload)="upload($event)">选择文件</button>
class Component {
  upload(data: Observable<any>) {
      data.pipe(
        scan((all: string[], row: any[]) => [...all, row], [])
      ).subscribe(rows => this.data = rows);
    }
}

Download

import { of } from 'rxjs';
import { NgCsvService } from '@qlee/ng-csv';

class Component {
  constructor(private ngCsvService: NgCsvService) {}
  
  download() {
      this.ngCsvService.download('test.csv', of({ name: 1, age: '222,asd' }, { name: 2 }));
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @qlee/ng-csv

Weekly Downloads

0

Version

0.0.3

License

none

Unpacked Size

99.2 kB

Total Files

26

Last publish

Collaborators

  • qlee