Cannot find primary outlet to load 'XYZComponent'

我是研究僧i 提交于 2019-12-24 02:05:08

问题


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:


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>


来源:https://stackoverflow.com/questions/42167047/cannot-find-primary-outlet-to-load-xyzcomponent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!