user in trouble
user in trouble

Reputation: 11

Angular 2 component doesn't work with my javascript

I noticed that if I write datepicker in the index.html file then jquery knows how to handle it but if the same element is part of angular component then clicking on it will not open the colander meaning jquery doesn’t know this element. How can I make it recognize the element inside the component template?

Upvotes: 1

Views: 160

Answers (1)

Scott Carmichael
Scott Carmichael

Reputation: 76

At the top of your component ts file, you could try declaring jquery vars.

declare var $ = window.$;
declare var jQuery = window.jQuery;

Upvotes: 1

Related Questions