I have an angular project and I have not found nice looking checkboxes in any of the css libraries that come close to jquery ui checkboxes and was wanting to use these in my angular project. Using jquery you can style checkboxes once the page loads using following code...
$(document).ready(function(){
$(":checkbox").checkboxradio();
});
providing you have the jquery libraries imported using.. something like this in the index.html file
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
although i have installed jquery with npm and there is probably another way to do this. Then in my component I have declared a variable between the imports and called the jquery function after initialisation ..
import { Component, AfterViewInit } from '@angular/core';
declare var $:any;
@Component({
selector: 'app-test',
template: `<label for="checkbox1">checkbox 1</label>
<input type="checkbox" name="checkbox1" id="checkbox1">`
})
export class CrimeTableComponent implements AfterViewInit {
ngAfterViewInit(): void {
$(document).ready(function(){
$( "#checkbox1" ).checkboxradio({
icon: false
});
});
}
I keep getting Uncaught TypeError: $(...).checkboxradio is not a function
Is this possible or am I doing something wrong?