Skip to content

Commit b0960e3

Browse files
author
Bart van den Eijnden
committed
use angular-seed to create initial project
0 parents  commit b0960e3

File tree

311 files changed

+85704
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+85704
-0
lines changed

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

README.md

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# angular-seed — the seed for AngularJS apps
2+
3+
This project is an application skeleton for a typical [AngularJS](http://angularjs.org/) web app.
4+
You can use it to quickly bootstrap your angular webapp projects and dev environment for these
5+
projects.
6+
7+
The seed contains AngularJS libraries, test libraries and a bunch of scripts all preconfigured for
8+
instant web development gratification. Just clone the repo (or download the zip/tarball), start up
9+
our (or yours) webserver and you are ready to develop and test your application.
10+
11+
The seed app doesn't do much, just shows how to wire two controllers and views together. You can
12+
check it out by opening app/index.html in your browser (might not work file `file://` scheme in
13+
certain browsers, see note below).
14+
15+
_Note: While angular is client-side-only technology and it's possible to create angular webapps that
16+
don't require a backend server at all, we recommend hosting the project files using a local
17+
webserver during development to avoid issues with security restrictions (sandbox) in browsers. The
18+
sandbox implementation varies between browsers, but quite often prevents things like cookies, xhr,
19+
etc to function properly when an html page is opened via `file://` scheme instead of `http://`._
20+
21+
22+
## How to use angular-seed
23+
24+
Clone the angular-seed repository and start hacking...
25+
26+
27+
### Running the app during development
28+
29+
You can pick one of these options:
30+
31+
* serve this repository with your webserver
32+
* install node.js and run `scripts/web-server.js`
33+
34+
Then navigate your browser to `http://localhost:<port>/app/index.html` to see the app running in
35+
your browser.
36+
37+
38+
### Running the app in production
39+
40+
This really depends on how complex is your app and the overall infrastructure of your system, but
41+
the general rule is that all you need in production are all the files under the `app/` directory.
42+
Everything else should be omitted.
43+
44+
Angular apps are really just a bunch of static html, css and js files that just need to be hosted
45+
somewhere, where they can be accessed by browsers.
46+
47+
If your Angular app is talking to the backend server via xhr or other means, you need to figure
48+
out what is the best way to host the static files to comply with the same origin policy if
49+
applicable. Usually this is done by hosting the files by the backend server or through
50+
reverse-proxying the backend server(s) and a webserver(s).
51+
52+
53+
### Running unit tests
54+
55+
We recommend using [jasmine](http://pivotal.github.com/jasmine/) and
56+
[Karma](http://karma-runner.github.io) for your unit tests/specs, but you are free
57+
to use whatever works for you.
58+
59+
Requires [node.js](http://nodejs.org/), Karma (`sudo npm install -g karma`) and a local
60+
or remote browser.
61+
62+
* start `scripts/test.sh` (on windows: `scripts\test.bat`)
63+
* a browser will start and connect to the Karma server (Chrome is default browser, others can be captured by loading the same url as the one in Chrome or by changing the `config/karma.conf.js` file)
64+
* to run or re-run tests just change any of your source or test javascript files
65+
66+
67+
### End to end testing
68+
69+
Angular ships with a baked-in end-to-end test runner that understands angular, your app and allows
70+
you to write your tests with jasmine-like BDD syntax.
71+
72+
Requires a webserver, node.js + `./scripts/web-server.js` or your backend server that hosts the angular static files.
73+
74+
Check out the
75+
[end-to-end runner's documentation](http://docs.angularjs.org/guide/dev_guide.e2e-testing) for more
76+
info.
77+
78+
* create your end-to-end tests in `test/e2e/scenarios.js`
79+
* serve your project directory with your http/backend server or node.js + `scripts/web-server.js`
80+
* to run do one of:
81+
* open `http://localhost:port/test/e2e/runner.html` in your browser
82+
* run the tests from console with [Karma](http://karma-runner.github.io) via
83+
`scripts/e2e-test.sh` or `script/e2e-test.bat`
84+
85+
### Continuous Integration
86+
87+
CloudBees have provided a CI/deployment setup:
88+
89+
<a href="https://grandcentral.cloudbees.com/?CB_clickstart=https://raw.github.com/CloudBees-community/angular-js-clickstart/master/clickstart.json"><img src="https://d3ko533tu1ozfq.cloudfront.net/clickstart/deployInstantly.png"/></a>
90+
91+
If you run this, you will get a cloned version of this repo to start working on in a private git repo,
92+
along with a CI service (in Jenkins) hosted that will run unit and end to end tests in both Firefox and Chrome.
93+
94+
### Receiving updates from upstream
95+
96+
When we upgrade angular-seed's repo with newer angular or testing library code, you can just
97+
fetch the changes and merge them into your project with git.
98+
99+
100+
## Directory Layout
101+
102+
app/ --> all of the files to be used in production
103+
css/ --> css files
104+
app.css --> default stylesheet
105+
img/ --> image files
106+
index.html --> app layout file (the main html template file of the app)
107+
index-async.html --> just like index.html, but loads js files asynchronously
108+
js/ --> javascript files
109+
app.js --> application
110+
controllers.js --> application controllers
111+
directives.js --> application directives
112+
filters.js --> custom angular filters
113+
services.js --> custom angular services
114+
lib/ --> angular and 3rd party javascript libraries
115+
angular/
116+
angular.js --> the latest angular js
117+
angular.min.js --> the latest minified angular js
118+
angular-*.js --> angular add-on modules
119+
version.txt --> version number
120+
partials/ --> angular view partials (partial html templates)
121+
partial1.html
122+
partial2.html
123+
124+
config/karma.conf.js --> config file for running unit tests with Karma
125+
config/karma-e2e.conf.js --> config file for running e2e tests with Karma
126+
127+
scripts/ --> handy shell/js/ruby scripts
128+
e2e-test.sh --> runs end-to-end tests with Karma (*nix)
129+
e2e-test.bat --> runs end-to-end tests with Karma (windows)
130+
test.bat --> autotests unit tests with Karma (windows)
131+
test.sh --> autotests unit tests with Karma (*nix)
132+
web-server.js --> simple development webserver based on node.js
133+
134+
test/ --> test source files and libraries
135+
e2e/ -->
136+
runner.html --> end-to-end test runner (open in your browser to run)
137+
scenarios.js --> end-to-end specs
138+
lib/
139+
angular/ --> angular testing libraries
140+
angular-mocks.js --> mocks that replace certain angular services in tests
141+
angular-scenario.js --> angular's scenario (end-to-end) test runner library
142+
version.txt --> version file
143+
unit/ --> unit level specs/tests
144+
controllersSpec.js --> specs for controllers
145+
directivessSpec.js --> specs for directives
146+
filtersSpec.js --> specs for filters
147+
servicesSpec.js --> specs for services
148+
149+
## Contact
150+
151+
For more information on AngularJS please check out http://angularjs.org/

app/css/.gitkeep

Whitespace-only changes.

app/css/app.css

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* app css stylesheet */
2+
3+
.menu {
4+
list-style: none;
5+
border-bottom: 0.1em solid black;
6+
margin-bottom: 2em;
7+
padding: 0 0 0.5em;
8+
}
9+
10+
.menu:before {
11+
content: "[";
12+
}
13+
14+
.menu:after {
15+
content: "]";
16+
}
17+
18+
.menu > li {
19+
display: inline;
20+
}
21+
22+
.menu > li:before {
23+
content: "|";
24+
padding-right: 0.3em;
25+
}
26+
27+
.menu > li:nth-child(1):before {
28+
content: "";
29+
padding: 0;
30+
}

app/img/.gitkeep

Whitespace-only changes.

app/index-async.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
[ng-cloak] {
7+
display: none;
8+
}
9+
</style>
10+
<script>
11+
// include angular loader, which allows the files to load in any order
12+
13+
/*
14+
AngularJS v1.2.9
15+
(c) 2010-2014 Google, Inc. http://angularjs.org
16+
License: MIT
17+
*/
18+
(function(){'use strict';function d(a){return function(){var c=arguments[0],b,c="["+(a?a+":":"")+c+"] http://errors.angularjs.org/1.2.9/"+(a?a+"/":"")+c;for(b=1;b<arguments.length;b++)c=c+(1==b?"?":"&")+"p"+(b-1)+"="+encodeURIComponent("function"==typeof arguments[b]?arguments[b].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[b]?"undefined":"string"!=typeof arguments[b]?JSON.stringify(arguments[b]):arguments[b]);return Error(c)}}(function(a){var c=d("$injector"),b=d("ng");a=a.angular||
19+
(a.angular={});a.$$minErr=a.$$minErr||d;return a.module||(a.module=function(){var a={};return function(e,d,f){if("hasOwnProperty"===e)throw b("badname","module");d&&a.hasOwnProperty(e)&&(a[e]=null);return a[e]||(a[e]=function(){function a(c,d,e){return function(){b[e||"push"]([c,d,arguments]);return g}}if(!d)throw c("nomod",e);var b=[],h=[],k=a("$injector","invoke"),g={_invokeQueue:b,_runBlocks:h,requires:d,name:e,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide",
20+
"service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:k,run:function(a){h.push(a);return this}};f&&k(f);return g}())}}())})(window)})(window);
21+
//# sourceMappingURL=angular-loader.min.js.map
22+
23+
// include a third-party async loader library
24+
/*!
25+
* $script.js v1.3
26+
* https://github.com/ded/script.js
27+
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
28+
* Follow our software http://twitter.com/dedfat
29+
* License: MIT
30+
*/
31+
!function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
32+
33+
// load all of the dependencies asynchronously.
34+
$script([
35+
'lib/angular/angular.js',
36+
'lib/angular/angular-route.js',
37+
'js/app.js',
38+
'js/services.js',
39+
'js/controllers.js',
40+
'js/filters.js',
41+
'js/directives.js'
42+
], function() {
43+
// when all is done, execute bootstrap angular application
44+
angular.bootstrap(document, ['myApp']);
45+
});
46+
</script>
47+
<title>My AngularJS App</title>
48+
<link rel="stylesheet" href="css/app.css">
49+
</head>
50+
<body ng-cloak>
51+
<ul class="menu">
52+
<li><a href="#/view1">view1</a></li>
53+
<li><a href="#/view2">view2</a></li>
54+
</ul>
55+
56+
<div ng-view></div>
57+
58+
<div>Angular seed app: v<span app-version></span></div>
59+
60+
</body>
61+
</html>

app/index-async.html.template

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
[ng-cloak] {
7+
display: none;
8+
}
9+
</style>
10+
<script>
11+
// include angular loader, which allows the files to load in any order
12+
@@NG_LOADER@@
13+
14+
// include a third-party async loader library
15+
/*!
16+
* $script.js v1.3
17+
* https://github.com/ded/script.js
18+
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
19+
* Follow our software http://twitter.com/dedfat
20+
* License: MIT
21+
*/
22+
!function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
23+
24+
// load all of the dependencies asynchronously.
25+
$script([
26+
'lib/angular/angular.js',
27+
'lib/angular/angular-route.js',
28+
'js/app.js',
29+
'js/services.js',
30+
'js/controllers.js',
31+
'js/filters.js',
32+
'js/directives.js'
33+
], function() {
34+
// when all is done, execute bootstrap angular application
35+
angular.bootstrap(document, ['myApp']);
36+
});
37+
</script>
38+
<title>My AngularJS App</title>
39+
<link rel="stylesheet" href="css/app.css">
40+
</head>
41+
<body ng-cloak>
42+
<ul class="menu">
43+
<li><a href="#/view1">view1</a></li>
44+
<li><a href="#/view2">view2</a></li>
45+
</ul>
46+
47+
<div ng-view></div>
48+
49+
<div>Angular seed app: v<span app-version></span></div>
50+
51+
</body>
52+
</html>

app/index.html

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype html>
2+
<html lang="en" ng-app="myApp">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>My AngularJS App</title>
6+
<link rel="stylesheet" href="css/app.css"/>
7+
</head>
8+
<body>
9+
<ul class="menu">
10+
<li><a href="#/view1">view1</a></li>
11+
<li><a href="#/view2">view2</a></li>
12+
</ul>
13+
14+
<div ng-view></div>
15+
16+
<div>Angular seed app: v<span app-version></span></div>
17+
18+
<!-- In production use:
19+
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
20+
-->
21+
<script src="lib/angular/angular.js"></script>
22+
<script src="lib/angular/angular-route.js"></script>
23+
<script src="js/app.js"></script>
24+
<script src="js/services.js"></script>
25+
<script src="js/controllers.js"></script>
26+
<script src="js/filters.js"></script>
27+
<script src="js/directives.js"></script>
28+
</body>
29+
</html>

app/js/app.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
4+
// Declare app level module which depends on filters, and services
5+
angular.module('myApp', [
6+
'ngRoute',
7+
'myApp.filters',
8+
'myApp.services',
9+
'myApp.directives',
10+
'myApp.controllers'
11+
]).
12+
config(['$routeProvider', function($routeProvider) {
13+
$routeProvider.when('/view1', {templateUrl: 'partials/partial1.html', controller: 'MyCtrl1'});
14+
$routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: 'MyCtrl2'});
15+
$routeProvider.otherwise({redirectTo: '/view1'});
16+
}]);

app/js/controllers.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
/* Controllers */
4+
5+
angular.module('myApp.controllers', []).
6+
controller('MyCtrl1', [function() {
7+
8+
}])
9+
.controller('MyCtrl2', [function() {
10+
11+
}]);

app/js/directives.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
/* Directives */
4+
5+
6+
angular.module('myApp.directives', []).
7+
directive('appVersion', ['version', function(version) {
8+
return function(scope, elm, attrs) {
9+
elm.text(version);
10+
};
11+
}]);

0 commit comments

Comments
 (0)