I have to use jQuery-Knob in a custom component. After a lot of search and try/miss attempts the only way in how I was able to init my Knob was wrapping the jQuery
function inside a setTimeout
with 0 seconds like this answer says.
constructor() {
console.log('Hello SsdKnob Component');
setTimeout(() => {
$(".dial").knob();
}, 0)
}
But if feels kind of hacky and maybe inestable? (I not sure if I will have problems because of some kind of racing conditions).
Is there a better/recommended way to do this?
I have tried without success:
ionViewLoaded() {
$(".dial").knob();
}
and
AfterViewInit() {
$(".dial").knob();
}