0

(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)

1 Answers1

0

Finally!!

Dropdown works perfectly. The problem was that I was applying a Pipe to convert enumerables on the values (for some reason this make it fail).

Each time it went to a page containing dropdowns with Enum it would fail.