Jquery 使用组件vs指令
我正在为我的html组件使用JQuery库(iCheck)。。因此,当我使用组件fot将其注入我的html组件时,它工作正常。。喜欢我的代码吗 ww.component.tsJquery 使用组件vs指令,jquery,angular,angularjs-directive,Jquery,Angular,Angularjs Directive,我正在为我的html组件使用JQuery库(iCheck)。。因此,当我使用组件fot将其注入我的html组件时,它工作正常。。喜欢我的代码吗 ww.component.ts import { ViewChild, ElementRef, AfterViewInit, Component } from '@angular/core'; declare var jQuery: any; @Component({ selector: 'my-icheck', templateUrl: '
import { ViewChild, ElementRef, AfterViewInit, Component } from '@angular/core';
declare var jQuery: any;
@Component({
selector: 'my-icheck',
templateUrl: 'icheck.component.html'
})
export class ICheck implements AfterViewInit {
@ViewChild('input') input;
ngAfterViewInit() {
jQuery(this.input.nativeElement).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
});
}
}
并在其他组件中使用:
<my-icheck></my-icheck>
在html组件中使用时:
ww.component.html
<label class="radio icheck-inline menu-label">
<input icheck type="radio" name="aa" value="ANN"> BUTTON RADIO
</label>
按钮收音机
使用icheck我的选择器的名称,我得到的结果不同:
有些人有问题?是的,你说得对……但这并不能解决问题。。。谢谢
<label class="radio icheck-inline menu-label">
<input icheck type="radio" name="aa" value="ANN"> BUTTON RADIO
</label>