I tried to use iChek library in Angular 4. But When i use it in my TypeScript file, i got an error like : "Property 'iCheck' does not exist on type 'JQuery'"
My Code :
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
import * as $ from 'jquery';
@Directive({
selector: '[icheck]'
})
export class IcheckDirective {
constructor(el: ElementRef) {
$(el).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
})
}
}
And I want to use this directive in my component like :
<label class="radio icheck-inline menu-label">
<input type="radio" icheck name="filters.type" value="IN"> Entrant
</label>
Someone have an issue please for resolve it ?
try this
declare var $: any;
@Directive({
selector: '[icheck]'
})
export class IcheckDirective {
$: any = $;
constructor(el: ElementRef) {
this.$(el.nativeElement).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
})
}
}