The first ES5 example in step 2 of the Angular Developer Guide
(https://angular.io/docs/js/latest/guide/displaying-data.html) does not
work. I've pasted the javascript exactly as it is shown in the example,
but it fails in at least two ways:
Problem 1. "angular" has not been defined. The previous example used "ng"
for the global accessor for angular, but now we're using "angular"? Okay,
maybe they changed it to "ng" and just forgot to update this example ...
except now "ng.ComponentAnnotation is not a function". Okay, maybe I need
"ng.core" or something. Let's search for "ComponentAnnotation" to see
where it is defined...
Problem 2. "ComponentAnnotation" does not exist anywhere in the Angular
code. What? I don't understand. I used "npm install" with the
packages.json from example 1, and neither "ComponentAnnotation" nor
"ViewAnnotation" appear anywhere in any of the JavaScript files. How can
that possibly be? Am I getting a bad version of angular2, or has Google
really not even tested their ES5 examples?
I'll paste my code below, although it's virtually identical to the example
code:
*Landing page:*
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>App</title>
<!-- 1. Load libraries -->
<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>
<!-- 2. Load our 'modules' -->
<script src='~/Ng2/app.js'></script>
<script src='~/Ng2/boot.js'></script>
</head>
<body>
<display>Loading...</display>
</body>
</html>
*app.js:*
function DisplayComponent() {
this.myName = "Alice";
}
DisplayComponent.annotations = [
new angular.ComponentAnnotation({
selector: "display"
}),
new angular.ViewAnnotation({
template:
'<p>My name: {{ myName }}</p>'
})
];
*package.json:*
{
"name": "angular2-quickstart",
"version": "1.0.0",
"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"
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.