6

I've done as described here: http://docs.angularjs.org/tutorial/step_00 but can't run the phonecat example as AngularJS. It runs like a bunch of html files. For example, the app/index-async.html page gives me following error in Chrome's console:

Uncaught Error: No module: myApp

This file contains

angular.bootstrap(document, ['myApp']);
2
  • What exactly have u done? I just cloned the git repo somewhere in my apaches htdocs and set it to stepp 00 and everything works fine for me. Commented Nov 23, 2012 at 14:54
  • tell me how to run a basic example.. i mean in what environment it should run.. i am just writing it as simple html and running. the concept of angular is very nice and i got it very quickly but none of tutorial said on how to execute it and environment setup :( Commented Aug 7, 2013 at 18:29

3 Answers 3

3

The bootstrap part needs to be called after the element you're bootstrapping to is loaded. You can either put the bootstrap code at the end of your html, or you can use something like document ready from JQuery.

Sign up to request clarification or add additional context in comments.

1 Comment

Adding angular.bootstrap(document, ['myApp']); to the end of the HTML template worked for me, but putting that inside jQuery's $(document).ready() did not work.
1

I had the same problem. When loading angular with reguirejs, you have to remove the ng-app directive from the html and add it after calling angular.bootstrap(document, ['myApp']) like this:

$(html).addClass('ng-app');

Check this seed project out: https://github.com/tnajdek/angular-requirejs-seed specifically index.html and app/js/main.js

Comments

-3

Make sure your web server is running.

If you are running node.js:
1. Run node scripts\web-server.js to start the web server
2. In your browser, navigate to http://localhost:8000/app/index.html

If you are running some other http server: (I used WAMP for the AngularJS tutorial you listed):
1. Make sure the /angular-phonecat repository was cloned into your wamp/www folder.
2. Navigate in your browser to http://localhost:[port-number]/angular-phonecat/app.

TIPS:
To change directories using WINDOWS COMMAND LINE -

cd /d c:\wamp\www

To change directories using GIT BASH -

$ cd /c/wamp/www 

Additional note: In Git Bash, to display the directory you're currently in, use $ pwd

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.