P
P
Pogran2016-11-16 15:24:20
Angular
Pogran, 2016-11-16 15:24:20

How to add a js file through a component?

the meaning is that I have a main component, into which I load common libraries for everyone. And there is a minor cvomponent. How can I add a js file to the secondary component? css files it is clear what can be added via styleUrls , but what about js files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2016-11-16
@Pogran

No way. Your component is the executable file. All other components are connected in style through node.js - the import command. To include third-party js, you need to do the following:
1. Create a node.js module
2. Write a TypeScript wrapper over this module
3. Connect the module to the project
4. Import the necessary classes (or something else) from this module into the component.
Or just insert js code into the component logic: all js scripts fit perfectly into ts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question