user6086008 user6086008 - 28 days ago 11
Javascript Question

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

Answer

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.

There's also an article on StackOverflow showing how to do it.