最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to import PapaParse with Browserify to inject into a controller? - Stack Overflow

programmeradmin0浏览0评论

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?

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?

Share Improve this question asked Nov 5, 2016 at 14:46 passatgtpassatgt 4,4325 gold badges43 silver badges56 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 16

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

import * as Papa from 'papaparse';

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

发布评论

评论列表(0)

  1. 暂无评论