I use a JQuery Library (iCheck) and I want to do a directive for use it in my html component but it does not work .. My code : Directive.ts
import { Directive, ElementRef, HostListener, Input, AfterViewInit } from '@angular/core';
declare var jQuery: any;
@Directive({
selector: '[icheck]'
})
export class IcheckDirective {
constructor(private el: ElementRef) { }
ngAfterViewInit() {
jQuery(this.el.nativeElement).iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal'});
}
}
xxx.component.html
<label class="radio">
<input type="radio" icheck name="filter" value="OF"> Other </label>
IE : icheck is the selector name in my directive. I Use Angular 4.