So I am starting to learn Angular and I am starting with 2.0 since it will break 1 to that point I am trying to get the quick start application from the angular web site to work
I set up the code as instructed and setup a web site in IIS to point to source code directory but I am getting an error.
Uncaught (in promise) Error loading "app" at http://localhost:88/app.js
http://localhost:88/app.js:1:46: Unexpected token angular2
Has anyone set up this app in IIS and if so can you help?
File app.js:
import {Component, Template, bootstrap} from angular2/angular2;
//Annotation section
@Component({
selector: 'my-app'
})
@Template({
inline: '<h1>Hello {{name}}</h1>'
})
//Component controller
class MyAppConponent{
constuctor(){
this.name = 'Alice';
}
}
bootstrap(MyAppConponent);
file index.html
<!-- index.html -->
<html>
<head>
<title>Angular 2 Quickstart</title>
<script src="/quickstart/dist/es6-shim.js"></script>
</head>
<body>
<!-- The app component created in app.es6 -->
<my-app></my-app>
<script>
// Rewrite the paths to load the files
System.paths = {
'angular2/*':'/quickstart/angular2/*.js', // Angular
'rtts_assert/*': '/quickstart/rtts_assert/*.js', // Runtime assertions
'app': 'app.js' // The my-app component
};
// Kick off the application
System.import('app');
</script>
</body>
</html>
Additionally - I did name the app file app.es6 as the site has indicated but I was seeing if the extension made a difference since es6 is the new javascript standard and the browse may not support it yet and I get
GET http://localhost:88/app.es6 404 (Not Found)
as an error with that extension.
I am using Chrome Canary for my browser
Looks like a syntax error
import {Component, Template, bootstrap} from 'angular2/angular2';
Should fix it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With