I am trying to get jQuery to work in my angular2 application. I am unable to post all of my code here but I will try to elaborate as much as I can. Any pointers would be appreciated.
my root app.ts file looks something similar to this
/// <reference path="../../typings/jquery/jquery.d.ts" />
import {Component,provide,DynamicComponentLoader,Injector,OnInit,AfterViewInit,ViewEncapsulation} from 'angular2/core';
declare var jQuery:JQueryStatic;
@Component({
selector: 'app',
templateUrl: './app/app.html',
encapsulation: ViewEncapsulation.None
})
export class app implements OnInit,AfterViewInit{
constructor(private elementRef: ElementRef)
ngOnInit() {
this.dcl.loadIntoLocation(HeaderComponent, this.elementRef, 'header');
this.dcl.loadIntoLocation(FooterComponent, this.elementRef, 'footer');
}
ngAfterViewInit() {
(<any>jQuery(this.elementRef.nativeElement).find('.datepicker').datepicker());
}
}
I am using bootstrap datepicker and am expecting the widget to fire when I click on an input with the datepicker class. But I can't get this to work.
I can get (<any>jQuery(this.elementRef.nativeElement).hide()); to work but not datepicker event.
datepicker.js or somethingneeded? I guess so.