简体   繁体   中英

angular 2 app component not loading

I am doing a simple angular 2 tutorial, but i just get 'loading' when trying to run my app. this is my index.html file

 <html>
      <head>
        <title>Angular CV </title>
        <base href="/">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="styles.css">
        <!-- 1. Load libraries -->
         <!-- Polyfill for older browsers -->
        <script src="node_modules/core-js/client/shim.min.js"></script>
        <script src="node_modules/zone.js/dist/zone.js"></script>
        <script src="node_modules/reflect-metadata/Reflect.js"></script>
        <script src="node_modules/systemjs/dist/system.src.js"></script>
        <!-- 2. Configure SystemJS -->
        <script src="systemjs.config.js"></script>
        <script>
          System.import('app').catch(function(err){ console.error(err); });
        </script>
      </head>
      <!-- 3. Display the application -->
      <body>
        <my-app>Still Loading...</my-app>
      </body>
    </html>

app.component.ts

import { Component } from '@angular/core';

    @Component({
      selector: 'my-app',
      template: ''
    })
    export class AppComponent {

    }

full code here: https://github.com/trinajoy/angularcv

Angular-cli changed their system from SystemJS to Webpack since beta.14 . It seems you're still using SystemJS, though.

You can migrate to Webpack following these instructions . However, as you're just following a tutorial, I'd recommend to install angular-cli from scratch .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM