Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用组件vs指令_Jquery_Angular_Angularjs Directive - Fatal编程技术网

Jquery 使用组件vs指令

Jquery 使用组件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: '

我正在为我的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: '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>