I begin with AngularJS 2 helped with the hello2ng2 (getting started).
I've created 2 files :
index.html :
<head>
<title>Angular 2 Hello World!</title>
<script src="/dist/es6-shim.js"></script>
</head>
<body>
<my-app></my-app>
<script>
// Rewrite the paths to load the files
System.paths = {
'angular2/*': '/angular2/*.js', // Angular
'rtts_assert/*': '/rtts_assert/*.js', // Runtime assertions
'app': 'app.es6' // The my-app component
};
// Kick off the application
System.import('app');
</script>
</body>
</html>
And app.es6 :
import {Component,template} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
// Annotation section
@Component({
selector: 'my-app'
})
@Template({
inline: '<h1>Hello {{ name }}</h1>'
})
// Component controller
class MyAppComponent {
constructor() {
this.name = 'World!';
}
}
bootstrap(MyAppComponent);
When I use the http-server (installed with npm), the "Hello World!" is not displayed with Chrome, but it is with Firefox. Any idea why ?
Thank you for your help :)