A
A
a1en_yeah2016-10-14 09:51:57
JavaScript
a1en_yeah, 2016-10-14 09:51:57

How to integrate third party JS libraries into Angular JS?

The task before me is to make a button for downloading the page as a .pdf file, for this there is a jspdf library, but it doesn’t reach me how to add it to the application ... in index.html I add, for example

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>

well, then, in a specific directive, you need to initialize it, but thoughts don’t go that far anymore .. =)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Markus Kelvin, 2016-10-14
@a1en_yeah

Everything is very easy once you download, this library is already available as a global variable and you can call it everywhere, you don't need to import anything or do dependency injection... it's much easier
and do what you want with it in a controller, directive or there is no difference in services.

Николай, 2016-10-14
@healqq

Сделайте factory-обертку для вашей библиотеки, инжектите куда угодно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question