Following Angular 2.0 Quickstart guide causes "app is not defined" error

angular

#1

I’m trying to follow the Angular 2.0 Quickstart guide. The guide accesses the angular code via its npm package, angular2 (v.2.0.0-beta.6). In my apps.components.js and main.js files, the app and ng variables give the error message “[app or ng] is not defined; please fix or add /global [app or ng]/”. When I then try to run node, it errors out with this message:

Debugger listening on port 15454
/home/ubuntu/workspace/app/app.component.js:3
app/app.component.js
^

ReferenceError: app is not defined
at Object. (/home/ubuntu/workspace/app/app.component.js:3:1)
at Module._compile (module.js:434:26)
at Object.Module._extensions…js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.runMain [as _onTimeout] (module.js:475:10)
at Timer.listOnTimeout (timers.js:89:15)

Process exited with code: 1

It appears it isn’t picking up the global variables from the angular node package. I don’t think this is a problem with the package itself since I got similar errors when I tried using angular 2.0 via downloading and including the code in a previous project.

My code and package.json file is the same as the angular 2.0 quickstart guide linked above.


#2

Nevermind. It works now.

Here I was making my workspace = my app. I tried the Angular2 quickstart again, this time putting the app within the workspace and not trying to make the entire workspace the app. I also started it with the Cloud9 PHP/Apache server. Now the app works, so one or both of these changes did the trick. Thanks.


#3

Thanks for following up, really good to have that feedback here.


#4

Hi I try to follow the quickstart guide for anglar2.
What do you mean by

Here I was making my workspace = my app. I tried the Angular2 quickstart again, this time putting the app within the workspace and not trying to make the entire workspace the app