I am trying to create a small sample to display a list using angular 2 beta. Here is the app.component.js file
(function(app) {
app.AppComponent = ng.core
.Component({
selector: 'my-app',
template:'<p>My name: {{ myName }}</p>' +
'<p>Friends:</p>' +
'<ul>' +
'<li *ng-for="#name of names">{{ name }}</li>' +
'</ul>',
directives: [angular.NgFor]
})
.Class({
constructor: function() {
this.myName = 'Peter';
this.names = ["Aarav", "Martín", "Shannon", "Ariana", "Kai"];
}
});
})(window.app || (window.app = {}));
I get the following error
Uncaught ReferenceError: angular not defined
Here is the HTML file
<html>
<head>
<title>Angular 2 QuickStart</title>
<script src="node_modules/es6-shim/es6-shim.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/rxjs/bundles/Rx.umd.js"></script>
<script src="node_modules/angular2/bundles/angular2-all.umd.js"></script>
<script src='app/app.component.js'></script>
<script src='app/boot.js'></script>
</head>
<body>
<my-app>Loading...</my-app>
</body>
</html>
Is the syntax used incorrectly here? I tried with angular example page on my official website
Arpit source
share