This application takes the developer through the process of building a web-application using angular. The application is loosely based on the Google Phone Gallery, which no longer exists. Here is a historical reference: Google Phone Gallery on WayBack.
Each tagged commit is a separate lesson teaching a single aspect of angular.
The full tutorial can be found at http://docs.angularjs.org/tutorial.
- Get Node.js.
- Install the tool dependencies (
npm install
)
- The application filesystem layout structure is based on the angular-seed project.
- There is no dynamic backend (no application server) for this application. Instead we fake the an application server by fetching static json files.
- Read the Development section at the end to familiarize yourself with running and developing an angular application.
You can check out any point of the tutorial using git checkout step-?
To see the changes which between any two lessons use the git diff command. git diff step-?..step-?
- Add ngApp directive to bootstrap the app
- Add simple template with an expression
- Add static html list with two phones into index.html. We will convert this static page into dynamic one with the help of angular.
- Convert the static html list into dynamic one by:
- creating
PhoneListCtrl
controller for the application - extracting the data from HTML, moving it into the controller as an in-memory dataset.
- converting the static HTML document into an Angular template with the use of the
ngRepeat
directive which iterates over the dataset of phones.ngRepeat
clones its contents for each instance in the dataset and renders it into the view.
- creating
- Add a simple unit test to show off how to write tests and run them with Karma
- Add a search box to demonstrate how:
- the data-binding works on input fields.
- to use the
filter
filter. ngRepeat
automatically shrinks and grows the number of phones in the view.
- Add an end-to-end test to:
- show how end-to-end tests are written and how to run them with Protractor.
- prove that the search box and the repeater are correctly wired together.
- Add
age
property to each phone in the data model. - Add a
<select>
input to change the phone list order. - Override the default order value in the controller.
- Add unit and e2e tests for this feature.
- Replace the in-memory dataset with data loaded from the server (in
the form of static
phones.json
file).- The
phones.json
file is loaded using the$http
service.
- The
- Demonstrate the use of [services][service] and dependency injection.
- The [$http] service is injected into the controller through dependency injection.
- Add phone images and links to new pages that show the phone details.
- Add end2end tests that verify the links to the detail pages.
- Add CSS to style the page just a notch.
-
Introduce the $route service which allows binding URLs for deep-linking with views:
- Create
PhoneCatCtrl
which governs the entire app and contains $route configuration. - Install
angular-route
using bower and load thengRoute
module. (Be sure to run npm install again.) - Copy route parameters to root scope
params
property for access in sub controllers. - Replace the contents of
index.html
with thengView
directive, which will display the partial template of the current route.
- Create
-
Create phone list route:
- Map
/phones
route toPhoneListCtrl
andpartails/phones-list.html
. - Preserve existing
PhoneListCtrl
controller. - Move existing html from
index.html
topartials/phone-list.html
.
- Map
-
Create phone details route:
- Map
/phones/<phone-id>
route toPhoneDetailCtrl
andpartails/phones-detail.html
. - Create empty placeholder
PhoneDetailsCtrl
controller.
- Map