Delving into the world of Angular, I decided to kickstart my learning journey by following the TypeScript quickstart tutorial on their official website (https://angular.io/guide/quickstart)
I'm currently navigating through ubuntu 14.04.
Despite meticulously executing each step as instructed, no errors are popping up at the end. However, the main component "my-app" fails to load; instead, all I see is a perpetual "Loading..." message.
Here's what's displaying in my browser
The index.html:
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) 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>Loading...</my-app>
</body>
</html>
app/app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent { }
Omitting the other configuration files which mirror the tutorial ones, the only adjustment made was in the tsconfig.json file:
"target": "es6",
This tweak proved necessary for functionality to ensue.
Why might the main component refuse to load? What could be causing this hiccup?
Edit: These error messages appeared in my browser console:
2 http://localhost:3000/node_modules/systemjs/dist/system.src.js Failed to load resource: the server responded with a status of 404 (Not Found)
systemjs.config.js:46 Uncaught TypeError: System.config is not a function
http://localhost:3000/app/ Failed to load resource: the server responded with a status of 404 (Not Found)
app:18 Not Found: http://localhost:3000/app
Error loading http://localhost:3000/app(anonymous function) @ app:18
http://localhost:3000/app/ Failed to load resource: the server responded with a status of 404 (Not Found)