# AngularJS Phone Catalog Tutorial Application
## Overview
This application takes the developer thought the process of building a web-application using
angular. The application is loosely based on
[Google phone gallery](http://www.google.com/phone/). Each commit is a separate lesson
teaching a single aspect of angular.
## Prerequisites
### Git
- A good place to learn about setting up git is [here][git-github]
- Git [home][git-home] (download, documentation)
### Node.js
- Generic [installation instructions][node-generic].
- Mac DMG [here][node-mac]
- Windows download from [here][node-windows]. (You will also need [7 Zip] to unzip the node archive)
(and don't forget to add `node.exe` to your executable path)
### Java
- http://www.java.com
## Workings of the application
- The application filesystem layout structure is based on the [angular-seed] project.
- There is no backend (no server) for this application. Instead we fake the XHRs by fetching
static json files.
- Read the Development section at the end to familiarize yourself with running and developing
an angular application.
## Commits / Tutorial Outline
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-?
### step-0
- Initial [angular-seed] project layout
### step-1
- We have converted the seed application by removing all of the boiler-plate code.
- We have added single static HTML file which shows a static list of phones. (we will convert this
static page into dynamic one with the help of angular)
### step-2
- Converted static page into dynamic one by:
- create a root controller for the application
- extracting the data from HTML into a the controller as a mock dataset
- convert the static document into a template with the use of `ng:` [directive] (iterate over
mock data using [ng:repeat] and render it into a view)
- Added unit test, which mostly shows how one goes about writing a unit test, rather then test
something of value on our mock dataset.
### step-3
- added a search box to demonstrate how:
- the data-binding works on input fields
- to use [$filter] function
- [ng:repeat] automatically shrinks and grows the number of phones in the view
- added an end-to-end test to:
- show how end-to-end tests are written and used
- to prove that the search box and the repeater are correctly wired together
### step-4
- replaced the mock data with data loaded from the server (in our case the JSON return is just a
static file)
- The JSON is loaded using the [$xhr] service
- Demonstrate the use of [services][service] and [dependency injection][DI]
- The [$xhr] is injected into the controller through [dependency injection][DI]
### step-5
- adding phone image and links to phone pages
- css to style the page just a notch
### step-6
- making the order predicate for catalog dynamic
- adding 'predicates' section to the view with links that control the order
- ordering defaults to 'age' property
- css sugar
### step-7
- Introduce the [$route] service which allows binding URLs for deep-linking with views
- Replace content of root controller PhonesCtrl with [$route] configuration
- Map `/phones' to PhoneListCtrl and partails/phones-list.html
- Map `/phones/phone-id' to PhoneDetailCtrl and partails/phones-detail.html
- Copy deep linking parameters to root controller `params` property for access in sub controllers
- Replace content of index.html with [ng:view]
- Create PhoneListCtrl view
- Move code which fetches phones data into PhoneListCtrl
- Move existing HTML from index.html to partials/phone-list.html
- Create PhoneDetailsCtrl view
- Wire [$route] service to map `/phanes/phone-id` to map to this controller.
- Empty PhoneDetailsCtrl
- Place holder partials/phane-details.html
### step-8
- Fetch data for and render phone detail view
- [$xhr] to fetch details for a specific phone
- template for the phone detailed view
- CSS to make it look pretty
- Detail data for phones in JSON format
### step-9
- replace [$xhr] with [$resource]
- demonstrate how a resource can be created using a [service]
## Development with angular-seed
The following docs apply to all angular-seed projects and since the phonecat tutorial is a project
based on angular-seed, the instructions apply to it as well.
### Running the app during development
1. run `./scripts/web-server.js`
2. navigate your browser to `http://localhost:8000/app/index.html` to see the app running in your
browser.
### Running unit tests
Requires java.
1. start `./scripts/test-server.sh` (on windows `scripts\test-server.bat`)
2. navigate your browser to `http://localhost:9876/`
3. click on: capture strict link
4. run `scripts/test.sh` (on windows `scripts\test.bat`)
5. edit files in `app/` or `src/` and save them
6. go to step 4.
### Continuous unit testing
Requires ruby and [watchr](https://github.com/mynyml/watchr) gem.
1. start JSTD server and capture a browser as described above
2. start watchr with `watchr scripts/watchr.rb`
3. in a different window/tab/editor `tail -f logs/jstd.log`
4. edit files in `app/` or `src/` and save them
5. watch the log to see updates
### End to end testing
Angular ships with a baked-in end-to-end test runner that understands angular, your app and allows
you to write your tests with jasmine-like BDD syntax.
Requires a webserver, node.js + `./scripts/web-server.js` or your backend server that hosts the angular static files.
Check out the
[end-to-end runner's documentation](http://docs.angularjs.org/guide/dev_guide.e2e-testing) for more
info.
* create your end-to-end tests in `test/e2e/scenarios.js`
* serve your project directory with your http/backend server or node.js + `scripts/web-server.js`
* to run do one of:
* open `http://localhost:port/test/e2e/runner.html` in your browser
* run the tests from console with [Testacular](vojtajina.github.com/testacular) via
`scripts/e2e-test.sh` or `script/e2e-test.bat`
## Application Directory Layout
app/ --> all of the files to be used in production
css/ --> css files
app.css --> default stylesheet
img/ --> image files
index.html --> app layout file (the main html template file of the app)
index-async.html --> just like index.html, but loads js files asynchronously
js/ --> javascript files
app.js --> application
controllers.js --> application controllers
directives.js --> application directives
filters.js --> custom angular filters
services.js --> custom angular services
lib/ --> angular and 3rd party javascript libraries
angular/
angular.js --> the latest angular js
angular.min.js --> the latest minified angular js
angular-*.js --> angular add-on modules
version.txt --> version number
partials/ --> angular view partials (partial html templates)
partial1.html
partial2.html
config/testacular.conf.js --> config file for running unit tests with Testacular
config/testacular-e2e.conf.js --> config file for running e2e tests with Testacular
scripts/ --> handy shell/js/ruby scripts
e2e-test.sh --> runs end-to-end tests with Testacular (*nix)
e2e-test.bat --> runs end-to-end tests with Testacular (windows)
test.bat --> autotests unit tests with Testacular (windows)
test.sh --> autotests unit tests with Testacular (*nix)
web-server.js --> simple development webse
没有合适的资源?快使用搜索试试~ 我知道了~
angularjs 开发实例
共192个文件
jpg:79个
js:33个
json:21个
4星 · 超过85%的资源 需积分: 50 734 下载量 7 浏览量
2013-05-30
15:37:06
上传
评论 9
收藏 9.54MB RAR 举报
温馨提示
angularjs的开发实例,解压,将文件夹方法tomcat中,即可运行。 访问/app/index.html
资源推荐
资源详情
资源评论
收起资源包目录
angularjs 开发实例 (192个子文件)
test-server.bat 548B
goto_step.bat 362B
e2e-test.bat 308B
test.bat 305B
config 335B
bootstrap.css 102KB
bootstrap.min.css 80KB
bootstrap-responsive.css 15KB
bootstrap-responsive.min.css 10KB
uploadify.css 2KB
app.css 63B
description 73B
exclude 240B
.gitignore 81B
.gitignore 16B
.gitignore 0B
.gitignore 0B
.gitignore 0B
HEAD 981B
HEAD 41B
HEAD 32B
index-async.html 3KB
list.html 633B
index.html 487B
detail.html 382B
runner.html 244B
pack-d16cea84e52ce13d44a5fd57a1317e923e4dc69b.idx 43KB
index 16KB
motorola-charm-with-motoblur.0.jpg 50KB
lg-axis.0.jpg 46KB
motorola-bravo-with-motoblur.2.jpg 45KB
t-mobile-g2.1.jpg 45KB
droid-pro-by-motorola.0.jpg 44KB
samsung-transform.3.jpg 42KB
motorola-xoom-with-wi-fi.0.jpg 39KB
droid-2-global-by-motorola.2.jpg 38KB
motorola-defy-with-motoblur.0.jpg 37KB
motorola-xoom-with-wi-fi.3.jpg 36KB
t-mobile-mytouch-4g.5.jpg 36KB
t-mobile-mytouch-4g.0.jpg 36KB
motorola-bravo-with-motoblur.0.jpg 36KB
samsung-galaxy-tab.0.jpg 32KB
samsung-showcase-a-galaxy-s-phone.0.jpg 32KB
samsung-mesmerize-a-galaxy-s-phone.0.jpg 32KB
motorola-xoom-with-wi-fi.1.jpg 32KB
droid-pro-by-motorola.1.jpg 32KB
dell-streak-7.4.jpg 32KB
motorola-defy-with-motoblur.1.jpg 32KB
dell-streak-7.3.jpg 32KB
droid-2-global-by-motorola.1.jpg 31KB
samsung-gem.0.jpg 31KB
t-mobile-g2.0.jpg 31KB
sanyo-zio.0.jpg 31KB
samsung-transform.0.jpg 30KB
motorola-xoom.0.jpg 30KB
motorola-charm-with-motoblur.2.jpg 27KB
motorola-xoom.1.jpg 27KB
motorola-atrix-4g.2.jpg 27KB
motorola-xoom.2.jpg 27KB
dell-streak-7.0.jpg 27KB
motorola-atrix-4g.0.jpg 27KB
dell-venue.0.jpg 26KB
dell-streak-7.1.jpg 26KB
t-mobile-mytouch-4g.3.jpg 26KB
samsung-galaxy-tab.1.jpg 25KB
nexus-s.3.jpg 24KB
samsung-transform.4.jpg 24KB
samsung-mesmerize-a-galaxy-s-phone.1.jpg 24KB
samsung-showcase-a-galaxy-s-phone.1.jpg 24KB
t-mobile-mytouch-4g.1.jpg 23KB
motorola-bravo-with-motoblur.1.jpg 23KB
motorola-charm-with-motoblur.1.jpg 23KB
samsung-galaxy-tab.3.jpg 22KB
motorola-atrix-4g.3.jpg 22KB
nexus-s.0.jpg 22KB
motorola-defy-with-motoblur.2.jpg 20KB
droid-2-global-by-motorola.0.jpg 19KB
motorola-atrix-4g.1.jpg 19KB
nexus-s.1.jpg 19KB
dell-venue.3.jpg 18KB
motorola-xoom-with-wi-fi.4.jpg 17KB
dell-venue.2.jpg 17KB
t-mobile-g2.2.jpg 17KB
motorola-xoom-with-wi-fi.5.jpg 17KB
samsung-gem.1.jpg 17KB
t-mobile-mytouch-4g.2.jpg 17KB
samsung-galaxy-tab.2.jpg 15KB
dell-venue.4.jpg 15KB
dell-venue.5.jpg 15KB
lg-axis.1.jpg 14KB
sanyo-zio.1.jpg 14KB
dell-venue.1.jpg 14KB
samsung-transform.1.jpg 10KB
lg-axis.2.jpg 10KB
samsung-galaxy-tab.5.jpg 10KB
samsung-transform.2.jpg 10KB
sanyo-zio.2.jpg 9KB
samsung-gem.2.jpg 9KB
nexus-s.2.jpg 8KB
samsung-mesmerize-a-galaxy-s-phone.3.jpg 8KB
共 192 条
- 1
- 2
wy80989413
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页