I studied this topic a bit and learned about the library typings that you need to use for typescript. What I struggled to find are examples of using, say, for jquery inside an angular 2 application.
Here are a few questions:
1) Where would I write my jQuery code, is it inside the class or inside the constructor of this class?
2) Do I need to use document.ready at any time to port jQuery code? those. if we write code inside the constructor, does it fire after this event?
A few use cases, is one of these correct?
example 1
export class MyApp { constructor() { $('.mydiv').hide(); } }
example 2
export class MyApp { constructor() { } $('.mydiv').hide(); }
example 3
export class MyApp { constructor() { } $( document ).ready(function() { $('.mydiv').hide(); } }
javascript jquery angularjs angular typescript
Ilja
source share