Angular2 - Error: The selector “app-root” did not match any elements

后端 未结 6 1566
灰色年华
灰色年华 2020-12-06 09:47

I am learning Angular 2, without prior experience of Angular. I was following this tutorial: https://www.barbarianmeetscoding.com/blog/2016/03/25/getting-started-with-angula

6条回答
  •  醉话见心
    2020-12-06 10:17

    In my case, I had included angular project2's dist content into angular project1's assets dir and I was trying to access it from http://localhost:4200/assets/project2/index.html. Bu Having an iframe inside project1's component.

    project1 was created with ng new project1 --prefix project1
    project2 was created with ng new project2 --prefix project2.

    I was getting Error: The selector "project1-root" did not match any elements.

    Not an elegant way to handle 2 angular projects, but I wanted something quick to test, and it didn't work. I ended up including project2 as a separate module in project1.

    Guess, listening to elders (to KISS) is a good thing =)

提交回复
热议问题