Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import PapaParse with Browserify to inject into a controller?

I'm trying to import PapaParse and use it inside a controller. This is what i tried so far:

import Papa from 'papaparse';
//import 'papaparse'; (tried it like this also)

angular.module('app').constant('Papa', window.Papa);

I think this is the right way to do it, but window.Papa is already undefined. What am i doing wrong?

like image 854
passatgt Avatar asked Nov 05 '16 14:11

passatgt


2 Answers

For me it works to import it this way in an Angular2 Component

import * as Papa from 'papaparse';

like image 165
c_froehlich Avatar answered Nov 03 '22 00:11

c_froehlich


I just had to import papaparse before angular, now its working fine!

like image 40
passatgt Avatar answered Nov 03 '22 01:11

passatgt