Angular2 Quick Start – ‘Cannot Get’ Message

I’ve been trying to do the quick start guide for Angular2. I did the example as instructed in the quick guide. However, when I ran it, it displayed the following message ‘Cannot Get’. Does anyone know why this is happening?

boot.js file

// JavaScript source code
(function (app) {
    document.addEventListener('DOMContentLoaded', function () {
        ng.platform.browser.bootstrap(app.AppComponent);
    });
})(window.app || (window.app = {}));

The app.component.js file

(function (app) {
    app.AppComponent = ng.core.Component({
        Selector: 'my-app',
        template: '<h1>My First Angular 2 App </h1>'
    })
    .class({
        constructor: function () { }
    });
})(window.app || window.app == {});

The index file

<html>

<head>
    <title>Angular 2 QuickStart</title>

    <!-- 1. Load libraries -->
    <script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.0/Rx.umd.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.0/angular2-all.umd.dev.js"></script>

    <!-- 2. Load our 'modules' -->
    <script src='app/app.component.js'></script>
    <script src='app/boot.js'></script>

</head>

<!-- 3. Display the application -->
<body>
    <my-app>Loading...</my-app>
</body>

</html>

Finally, the package.json file

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "npm run lite",
    "lite": "lite-server"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.0",
    "systemjs": "0.19.6",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.10"
  },
  "devDependencies": {
    "lite-server": "^1.3.1"
  }
}

I ran the line ‘npm start’ which opened the browser and displayed ‘Cannot Get’

Answer

I figured out what the issue was. I had an extra space in my html file which was causing the error. I removed the extra space, and it worked as expected.