与角JS PapaParse [英] PapaParse with Angular JS
问题描述
喜欢漂亮的CSV分析器和放大器; PapaParse的逆向解析器。任何一个可以帮助我得到这个角度与JS结合起来。
Liked the nice CSV parser & unparser of PapaParse. Can any one help me to get this combine with Angular JS.
我喜欢让PapaParse工作方式角。试图寻求解决方案。
I like to make PapaParse work in Angular Way. Trying for a solution.
推荐答案
您可以使用值
来提供自包含的第三方库。
You can use value
to provide self contained third party libraries.
angular.module('your.app')
.value('yourLib', yourLib);
然后在您的控制器或服务,你把它用DI正常的方式
Then in your controller, or service, you would bring it in the normal way using DI
angular.module('your.app')
.controller('YourController', YourController);
YourController.$inject = ['yourLib'];
function YourController(yourLib) {
//. . .
}
如果第三方行是一个构造函数,需要它是newed,你可能要创建一个工厂或具有接受通行证PARAMS给构造函数返回一个新的实例的方法的供应商。
If the third party line is a constructor function, requires it be newed, you may want to create a factory or a provider that has a method that accepts the passes params to the constructor returns a new instance.
的修改的
看着PapaParse后,你会希望使用值
角喷油器进行注册。
After looking at PapaParse, you would want to register it with the angular injector using value
.
这篇关于与角JS PapaParse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!