Cannot find primary outlet to load 'XYZCompone

2019-07-11 22:52发布

I've got ng2 code loading in a .Net MVC component but the following error displays in the console:

EXCEPTION: Uncaught (in promise): Error: Cannot find primary outlet to load 'UsersComponent' Error: Cannot find primary outlet to load 'UsersComponent'

Any idea what the issue might be? I'm using ng2-final and my app does work. However, I've been asked to dev a reference implementation so I need to make sure that errors don't display in the console after the page loads.

1条回答
可以哭但决不认输i
2楼-- · 2019-07-11 23:55

This error usually occurs when you are using the Router and you haven't declared an outlet for the router to use in your HTML:

<router-outlet></router-outlet>
查看更多
登录 后发表回答