2016-11-05 29 views
0

(第一篇文章曾经..对不起任何错误)CLOSED - angular2语义UI下拉路线上改变失败

我一直在Angular2和语义的UI下拉玩耍。 我已经失去了我的想法,因为它已经两天了,我不知道这个问题。

我有分量“dropdown.component”,当它运行ngAfterViewInit它调用

//////////////////// 
// 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 }) 
    }); 
} 

这完美的作品,当我重新加载页面上的第一次(一个或多个dropdown.component),尽管当我使用router.navigate访问一个页面时,routerLink或者简单地回到dropdown.component存在的页面,浏览器在尝试初始化第一个下拉菜单后会冻结。

任何想法或指导方针?

(谢谢)

回答

0

终于!!

下拉菜单完美。问题是我正在应用一个Pipe来将枚举值转换为值(因为某些原因导致它失败)。

每当它进入包含Enum下拉列表的页面时,它都会失败。