# Installation `npm i angular2-csv2json --save`
npm install angular2-csv2jsonnpm i angular2-csv2json --save> In your module.ts,
```
import { CSV2JSONModule } from 'angular2-csv2json';
> Then import it into your @NgModule
``
@NgModule({
..
imports: [
CSV2JSONModule
],..
})
> in your .html,
``
[errorMsg]="'custom error msg'"
(response)='onUpload($event)'
>
* 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
}
}
MIT © Prithivraj200