Angular2 Selector did not match any elements with bundle and ECM6

后端 未结 1 676
忘了有多久
忘了有多久 2021-02-20 08:10

I have a very simple angular2 project, configured to work with Gulp, Bundle and ECM6. Bundle will create a big file which contains the translated ECM5 of angular plus my app.

相关标签:
1条回答
  • 2021-02-20 08:41

    The problem was that I was including the bundle.js before the mainapp component was defined in the HTML. This fixed the issue.

    <!DOCTYPE html>
    <html>
    <head>
        <title>Angular 2 Test</title>
    
    </head>
    
    <body>
    <mainapp>
    
    </mainapp>
    <script src="bundle.js"></script>
    </body>
    </html>
    

    Update:

    <script src="bundle.js" defer></script>
    

    Seems to also solve the problem regardless of the order of the elements.

    0 讨论(0)
提交回复
热议问题