Angular2 - The selector "my-app" did not match any elements (only on first load)

10,274

Solution 1

Probably you should add your <script> tag in your index.html file after </body> tag.

Your script should run after DOM is ready.

Update:

<body>
  <my-app>Loading...</my-app>
  <script>
    //Your scripts
  </script>
</body>

Solution 2

I guess there is no element in index.html that matches the selector in AppComponent.

Share:
10,274

Related videos on Youtube

emirhosseini
Author by

emirhosseini

Updated on September 15, 2022

Comments