(First post ever .. sorry for any mistakes)
I have been playing around with Angular2 and Semantic-UI dropdown. I'm losing my mind since it's been two days and I can't figure it out the problem.
I have a component "dropdown.component" when it runs the ngAfterViewInit it calls
////////////////////
// dropdown.component
////////////////////
ngAfterViewInit(){
this.dom.loadDrop($(this.elementRef.nativeElement).find('select'));
}
ngOnDestroy(){
//I am doing the .dropdown('destroy') -- although this will only disable.
//Could not find nothing to unbind the dropdown.
}
////////////////////
//inside dom class
////////////////////
loadDrop(elm: any) {
if (typeof (elm) === 'string') {
elm = $(elm);
}
$(document).ready(function () {
elm.dropdown({ allowAdditions: true })
});
}
This works perfect when I reload the page on the first time (with one or multiple dropdown.component), although when I access a page with the router.navigate, routerLink or do a simple back to a page where the dropdown.component exists, the browser freeze after trying initializing the first dropdown.
Any ideas or guidelines?
(thanks)