Using jquery with Angular2-Meteor


#1

I’m just getting up to speed on Angular2/Meteor and was wondering what the best way would be to incorporate something like this: https://atmospherejs.com/rajit/bootstrap3-datepicker

Given a component, with a View:
template:’’;

I wasn’t sure where to place the jquery
$(’#my-datepicker’).datepicker();

So really two questions: Where is proper place to but the jquery and how to I get Typescript to not complain that jquery doesn’t have a property called “datepicker”?

or what other steps I needed to take.

Thanks!


#2

I’m not sure about the implications of using Angular2, but maybe you could use something like this:
https://atmospherejs.com/angularui/angular-ui-bootstrap

Generally speaking, if you are using Angular you should reduce/eliminate your usage of jQuery whenever possible.


#3

Thanks, I’d love to get rid of jquery completely but there are a lot of components that I can’t find a high quality Angular only equivalent of and I don’t want to reinvent the wheel on things as generic as a date picker. There are of course some Angular datepickers but that was just an example I figured was easy to explain.

As for the bootstrap package, that isn’t the problem. I don’t know where in the component is the correct place to put the jquery code as I’m new to Angular2.


#4

Did you ever figure out how to do this? As you pointed out there are some jQuery plugins that don’t have Angular 2 counterparts which I would like to use without rewriting them.