Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple components match node with tagname app-lobby

Tags:

angular

the code was running fine on angular version 8.3.4 but when i updated it to the latest version of angular ( 9 ) i got the following error

following is the stack trace

core.js:3866 ERROR Error: Uncaught (in promise): Error: Multiple components match node with tagname app-lobby
Error: Multiple components match node with tagname app-lobby
at throwMultipleComponentError (core.js:5511)
at findDirectiveDefMatches (core.js:8276)
at resolveDirectives (core.js:8080)
at elementStartFirstCreatePass (core.js:14215)
at ɵɵelementStart (core.js:14249)
at Module.ɵɵelement (core.js:14324)
at MainComponent_Template (main.component.html:1)
at executeTemplate (core.js:7562)
at renderView (core.js:7387)
at renderComponent (core.js:8577)
at resolvePromise (zone.js:836)
at resolvePromise (zone.js:795)
at zone.js:897
at ZoneDelegate.invokeTask (zone.js:431)
at Object.onInvokeTask (core.js:27769)
at ZoneDelegate.invokeTask (zone.js:430)
at Zone.runTask (zone.js:198)
at drainMicroTaskQueue (zone.js:611)
at ZoneTask.invokeTask (zone.js:517)
at ZoneTask.invoke (zone.js:502)
like image 320
Vikas Bhardwaj Avatar asked Mar 02 '20 04:03

Vikas Bhardwaj


2 Answers

Probably you have more than one component with the same selector tag name app-lobby

...
@Component({
   selector: 'app-lobby',
...

Please double check to ensure that only one component selector tag name is app-lobby.

like image 131
Albert Avatar answered Sep 18 '22 12:09

Albert


The two answers above about declaring DatePipe in providers should be considered. Today I met this problem (Angular 9) when adding an argument private datePipe: DatePipe in the constructor of my component without declaring DatePipe in the module's provider. After adding DatePipe in providers, I have no more the problem.

The constructor :

constructor(private authenticationService: AuthenticationService, private datePipe: DatePipe) {}
like image 41
user2402432 Avatar answered Sep 17 '22 12:09

user2402432