Y
Y
yakupov1122018-06-11 19:27:54
JavaScript
yakupov112, 2018-06-11 19:27:54

How to properly connect jQuery plugins in Angular 2?

I did the layout and built the project using gulp, combined all the libraries and plugins into 1 file. Next, I connected it and scripts to .angular-cli

"scripts": [
"./assets/js/libs.min.js",
"./assets/js/common.js"
]


After loading the page, everything works, but if you do routing in the project, after switching through the pages, the scripts stop working. Is it possible to connect jquery and plugins in this way? And how to make them work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexaZem, 2018-06-12
@AlexaZem

connect jQuery plugins in Angular 2

In general, a bad idea, it's better to look for an npm package under angular | rewrite the plugin/package for yourself | write your module. And the best option is to find a similar module for Angular, throw out everything superfluous and organize it into your own custom module. With further updates of individual modules or when switching to new versions of angular, there will be less crap.
And for the sake of interest, what kind of plugins are there that you can’t do without them?))
Or if
I did the layout and built the project using gulp, combined all the libraries and plugins into 1 file
why do you need angular?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question