1 # angular-seed — the seed for <angular/> apps
3 This project is an application skeleton for a typical [angular](http://angularjs.org/) web app. You
4 can use it to quickly bootstrap your angular webapp projects and dev environment for these projects.
6 The seed contains angular libraries, test libraries and a bunch of scripts all preconfigured for
7 instant web development gratification. Just clone the repo (or download the zip/tarball), start up
8 our (or yours) webserver and you are ready to develop and test your application.
10 The seed app doesn't do much, just shows how to wire two controllers and views together. You can
11 check it out by opening app/index.html in your browser (might not work file `file://` scheme in
12 certain browsers, see note below).
14 _Note: While angular is client-side-only technology and it's possible to create angular webapps that
15 don't require a backend server at all, we recommend hosting the project files using a local
16 webserver during development to avoid issues with security restrictions (sandbox) in browsers. The
17 sandbox implementation varies between browsers, but quite often prevents things like cookies, xhr,
18 etc to function properly when an html page is opened via `file://` scheme instead of `http://`._
21 ## How to use angular-seed
23 Clone the angular-seed repository and start hacking...
26 ### Running the app during development
28 You can pick one of these options:
30 * serve this repository with your webserver
31 * install node.js and run `scripts/web-server.js`
33 Then navigate your browser to `http://localhost:<port>/app/index.html` to see the app running in
37 ### Running the app in production
39 This really depends on how complex is your app and the overall infrastructure of your system, but
40 the general rule is that all you need in production are all the files under the `app/` directory.
41 Everything else should be omitted.
43 angular apps are really just a bunch of static html, css and js files that just need to be hosted
44 somewhere, where they can be accessed by browsers.
46 If your angular app is talking to the backend server via xhr or other means, you need to figure
47 out what is the best way to host the static files to comply with the same origin policy if
48 applicable. Usually this is done by hosting the files by the backend server or through
49 reverse-proxying the backend server(s) and a webserver(s).
52 ### Running unit tests
54 We recommend using [jasmine](http://pivotal.github.com/jasmine/) and
55 [JsTestDriver](http://code.google.com/p/js-test-driver/) for your unit tests/specs, but you are free
56 to use whatever works for you.
58 Requires java and a local or remote browser.
60 * start `scripts/test-server.sh`
61 * navigate your browser to `http://localhost:9876/`
62 * click on one of the capture links (preferably the "strict" one)
63 * run `scripts/test.sh`
66 ### Continuous unit testing
68 Requires ruby and [watchr](https://github.com/mynyml/watchr) gem.
70 * start JSTD server and capture a browser as described above
71 * start watchr as `watchr scripts/watchr.rb`
72 * in a different window/tab/editor `tail -f logs/jstd.log`
73 * edit files in `app/` or `src/` and save them
74 * watch the log to see updates
76 There are many other ways to achieve the same effect. Feel free to use them if you prefer them over
80 ### End to end testing
82 angular ships with a baked-in end-to-end test runner that understands angular, your app and allows
83 you to write your tests with jasmine-like BDD syntax.
85 Requires a webserver, node.js or your backend server that hosts the angular static files.
87 * create your end-to-end tests in `test/e2e/scenarios.js`
88 * serve your project directory with your http/backend server or node.js + `scripts/web-server.js`
89 * open `http://localhost:port/test/e2e/runner.html` in your browser
92 ### Receiving updates from upstream
94 When we upgrade angular-seed's repo with newer angular or testing library code, you can just
95 fetch the changes and merge them into your project with git.
100 app/ --> all of the files to be used in production
102 app.css --> default stylesheet
104 js/ --> javascript files
105 controllers.js --> application controllers
106 filters.js --> custom angular filters
107 services.js --> custom angular services
108 widgets.js --> custom angular widgets
109 lib/ --> angular and 3rd party javascript libraries
111 angular.js --> the latest angular js
112 angular.min.js --> the latest minified angular js
113 angular-ie-compat.js --> angular patch for IE 6&7 compatibility
114 version.txt --> version number
115 partials/ --> angular view partials (partial html templates)
119 jsTestDriver.conf --> config file for JsTestDriver
121 logs/ --> JSTD and other logs go here (git-ignored)
123 scripts/ --> handy shell/js/ruby scripts
124 test-server.sh --> starts JSTD server
125 test.sh --> runs all unit tests
126 watchr.rb --> config script for continuous testing with watchr
127 web-server.js --> simple development webserver based on node.js
129 test/ --> test source files and libraries
131 runner.html --> end-to-end test runner (open in your browser to run)
132 scenarios.js --> end-to-end specs
134 angular/ --> angular testing libraries
135 angular-mocks.js --> mocks that replace certain angular services in tests
136 angular-scenario.js --> angular's scenario (end-to-end) test runner library
137 version.txt --> version file
138 jasmine/ --> Pivotal's Jasmine - an elegant BDD-style testing framework
139 jasmine-jstd-adapter/ --> bridge between JSTD and Jasmine
140 jstestdriver/ --> JSTD - JavaScript test runner
141 unit/ --> unit level specs/tests
142 controllersSpec.js --> specs for controllers
146 For more information on angular please check out http://angularjs.org/