The selector “my-app” did not match any elements

前端 未结 12 1154
逝去的感伤
逝去的感伤 2020-12-07 18:15

The problem is when I run my app, it works fine. But when I refresh it, most of the time I get below msg.

The selector \"my-app\" did not match any e

12条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 18:57

    This happened to me when I changed the bootstrap component from AppComponent to a new component. When you change it you need to change it in the main index.html as well. index.html should contain the bootstrap component.

    For example, if you change the app-component to app-login in app.module.ts in the bootstrap section then you should update your index.html like this

    
      
    
    

提交回复
热议问题