How to use jquery and other plug-ins in angular2
For example:
class MyComponent {
constructor() {
// how to query the DOM element from here?
}
}
Although I have read a few answers, I don’t understand them, and I have failed to try them myself. Please give me some advice
First install jquery
or
Write in the header of the ts file you need to use
This way you can use jquery in your ts file
Like it, but it is not recommended to use Jquery in angular2, it is easy to be contaminated
ng2 Don’t use jquery, there is no need
If you pass the dom, just specify it
#content
in the template