'Can I use two different '''merge''' inside a single '''ngAfterViewInit'''?

I am using material nav and have two views under it, for that I have merged a number of events like this, '''merge(this.Sort.sortChange, this.Paginator.page, fromEvent(this.Btn.nativeElement, 'click'), ''' and I also have similar merge inside the same ngAfterInit(), is there any way there won't be a conflict among paginator and sort events . because of having two different merge my second view is not rendering data and all sorting and paginator events for the second view are also being triggered by the first view .



Solution 1:[1]

I couldn't figure out the problem but this was solved by a collegue. The problem was with the variables I was using or so, as the component was discarded we will never know the actual reason behind it. For now we are already using multiple merge inside a single lifecycle function and they are working fine afa we know. If you are also planning to do the same, make sure to create diff variables for all uses.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paras Bartwal