Improve this doc

A great way to get introduced to AngularJS is to work through this tutorial, which walks you through the construction of an AngularJS web app. The app you will build is a catalog that displays a list of Android devices, lets you filter the list to see only devices that interest you, and then view details for any device.

Working with the code - 图1

Work through the tutorial to see how Angular makes browsers smarter — without the use of extensions or plug-ins. As you work through the tutorial, you will:

  • See examples of how to use client-side data binding and dependency injection to build dynamic views of data that change immediately in response to user actions.
  • See how Angular creates listeners on your data without the need for DOM manipulation.
  • Learn a better, easier way to test your web apps.
  • Learn how to use Angular services to make common web tasks, such as getting data into your app, easier.

And all of this works in any browser without modification to the browser!

When you finish the tutorial you will be able to:

  • Create a dynamic application that works in any browser.
  • Define the differences between Angular and common JavaScript frameworks.
  • Understand how data binding works in AngularJS.
  • Use the angular-seed project to quickly boot-strap your own projects.
  • Create and run tests.
  • Identify resources for learning more about AngularJS.

The tutorial guides you through the entire process of building a simple application, including writing and running unit and end-to-end tests. Experiments at the end of each step provide suggestions for you to learn more about AngularJS and the application you are building.

You can go through the whole tutorial in a couple of hours or you may want to spend a pleasant day really digging into it. If you're looking for a shorter introduction to AngularJS, check out the Getting Started document.

Working with the code

You can follow this tutorial and hack on the code in either the Mac/Linux or the Windows environment. The tutorial relies on the use of Git versioning system for source code management. You don't need to know anything about Git to follow the tutorial. Select one of the tabs below and follow the instructions for setting up your computer.

  • You'll need Git, which you can get from the Git site.

  • Clone the angular-phonecat repository located at Github by running the following command:

  1. git clone https://github.com/angular/angular-phonecat.git

This command creates the angular-phonecat directory in your current directory.

  • Change your current directory to angular-phonecat:
  1. cd angular-phonecat

The tutorial instructions, from now on, assume you are running all commands from the angular-phonecat directory.

  • You will also need Node.js and Karma to run unit tests, so please verify that you have Node.js v0.10 or better installed and that the node executable is on your PATH by running the following command in a terminal window:
  1. node --version

Additionally install Karma and its plugins if you don't have it already:

  1. npm install -g karma
  2. npm install
  • You will need an http server running on your system. Mac and Linux machines typically have Apache pre-installed, but If you don't already have one installed, you can use node to run scripts/web-server.js, a simple bundled http server.
  • You will need Node.js and Karma to run unit tests, so please verify that you have Node.js v0.10 or better installed and that the node executable is on your PATH by running the following command in a terminal window:
  1. node --version

Additionally install Karma if you don't have it already:

  1. npm install -g karma
  • You'll also need Git, which you can get from the Git site.

  • Clone the angular-phonecat repository located at Github by running the following command:

  1. git clone https://github.com/angular/angular-phonecat.git

This command creates the angular-phonecat directory in your current directory.

  • Change your current directory to angular-phonecat:
  1. cd angular-phonecat

The tutorial instructions assume you are running all commands from the angular-phonecat directory.

You should run all git commands from Git bash.

Other commands like test.bat or e2e-test.bat should be executed from the Windows command line.

  • You need an http server running on your system, but if you don't already have one already installed, you can use node to run scripts\web-server.js, a simple bundled http server.

The last thing to do is to make sure your computer has a web browser and a good text editor installed. Now, let's get some cool stuff done!

Get Started!