This repository was archived by the owner on Mar 7, 2023. It is now read-only.
forked from angular/angular-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3f2cce0
Showing
42 changed files
with
29,648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
**/.DS_Store | ||
nbproject | ||
manifest.mf | ||
build.xml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# angular-seed — the seed for <angular/> apps | ||
|
||
This project is an application skeleton for a typical [angular](http://angularjs.org/) web app. You | ||
can use it to quickly bootstrap your angular webapp projects and dev environment for these projects. | ||
|
||
The seed contains angular libraries, test libraries and a bunch of scripts all preconfigured for | ||
instant web development gratification. Just clone the repo (or download the zip/tarball), start up | ||
our (or yours) webserver and you are ready to develop and test your application. | ||
|
||
The seed app doesn't do much, just shows how to wire two controllers and views together. You can | ||
check it out by opening app/index.html in your browser (might not work file `file://` scheme in | ||
certain browsers, see note below). | ||
|
||
_Note: While angular is client-side-only technology and it's possible to create angular webapps that | ||
don't require a backend server at all, we recommend hosting the project files using a local | ||
webserver during development to avoid issues with security restrictions (sandbox) in browsers. The | ||
sandbox implementation varies between browsers, but quite often prevents things like cookies, xhr, | ||
etc to function properly when an html page is opened via `file://` scheme instead of `http://`._ | ||
|
||
|
||
## How to use angular-seed | ||
|
||
Clone the angular-seed repository and start hacking... | ||
|
||
|
||
### Running the app during development | ||
|
||
You can pick one of these options: | ||
|
||
* serve this repository with your webserver | ||
* install node.js and run `scripts/web-server.js` | ||
|
||
Then navigate your browser to `http://localhost:<port>/app/index.html` to see the app running in | ||
your browser. | ||
|
||
|
||
### Running the app in production | ||
|
||
This really depends on how complex is your app and the overall infrastructure of your system, but | ||
the general rule is that all you need in production are all the files under the `app/` directory. | ||
Everything else should be omitted. | ||
|
||
angular apps are really just a bunch of static html, css and js files that just need to be hosted | ||
somewhere, where they can be accessed by browsers. | ||
|
||
If your angular app is talking to the backend server via xhr or other means, you need to figure | ||
out what is the best way to host the static files to comply with the same origin policy if | ||
applicable. Usually this is done by hosting the files by the backend server or through | ||
reverse-proxying the backend server(s) and a webserver(s). | ||
|
||
|
||
### Running unit tests | ||
|
||
We recommend using [jasmine](http://pivotal.github.com/jasmine/) and | ||
[JsTestDriver](http://code.google.com/p/js-test-driver/) for your unit tests/specs, but you are free | ||
to use whatever works for you. | ||
|
||
Requires java and a local or remote browser. | ||
|
||
* start `scripts/test-server.sh` | ||
* navigate your browser to `http://localhost:9876/` | ||
* click on one of the capture links (preferably the "strict" one) | ||
* run `scripts/test.sh` | ||
|
||
|
||
### Continuous unit testing | ||
|
||
Requires ruby and [watchr](https://github.com/mynyml/watchr) gem. | ||
|
||
* start JSTD server and capture a browser as described above | ||
* start watchr as `watchr scripts/watchr.rb` | ||
* in a different window/tab/editor `tail -f logs/jstd.log` | ||
* edit files in `app/` or `src/` and save them | ||
* watch the log to see updates | ||
|
||
There are many other ways to achieve the same effect. Feel free to use them if you prefer them over | ||
watchr. | ||
|
||
|
||
### 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 or your backend server that hosts the angular static files. | ||
|
||
* 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` | ||
* open `http://localhost:port/test/e2e/runner.html` in your browser | ||
|
||
|
||
### Receiving updates from upstream | ||
|
||
When we upgrade angular-seed's repo with newer angular or testing library code, you can just | ||
fetch the changes and merge them into your project with git. | ||
|
||
|
||
## Directory Layout | ||
|
||
app/ --> all of the files to be used in production | ||
css/ --> css files | ||
app.css --> default stylesheet | ||
img/ --> image files | ||
js/ --> javascript files | ||
controllers.js --> application controllers | ||
filters.js --> custom angular filters | ||
services.js --> custom angular services | ||
widgets.js --> custom angular widgets | ||
lib/ --> angular and 3rd party javascript libraries | ||
angular/ | ||
angular.js --> the latest angular js | ||
angular.min.js --> the latest minified angular js | ||
angular-ie-compat.js --> angular patch for IE 6&7 compatibility | ||
version.txt --> version number | ||
partials/ --> angular view partials (partial html templates) | ||
partial1.html | ||
partial2.html | ||
|
||
jsTestDriver.conf --> config file for JsTestDriver | ||
|
||
logs/ --> JSTD and other logs go here (git-ignored) | ||
|
||
scripts/ --> handy shell/js/ruby scripts | ||
test-server.sh --> starts JSTD server | ||
test.sh --> runs all unit tests | ||
watchr.rb --> config script for continuous testing with watchr | ||
web-server.js --> simple development webserver based on node.js | ||
|
||
test/ --> test source files and libraries | ||
e2e/ --> | ||
runner.html --> end-to-end test runner (open in your browser to run) | ||
scenarios.js --> end-to-end specs | ||
lib/ | ||
angular/ --> angular testing libraries | ||
angular-mocks.js --> mocks that replace certain angular services in tests | ||
angular-scenario.js --> angular's scenario (end-to-end) test runner library | ||
version.txt --> version file | ||
jasmine/ --> Pivotal's Jasmine - an elegant BDD-style testing framework | ||
jasmine-jstd-adapter/ --> bridge between JSTD and Jasmine | ||
jstestdriver/ --> JSTD - JavaScript test runner | ||
unit/ --> unit level specs/tests | ||
controllersSpec.js --> specs for controllers | ||
|
||
## Contact | ||
|
||
For more information on angular please check out http://angularjs.org/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* app css stylesheet */ | ||
|
||
.menu { | ||
list-style: none; | ||
border-bottom: 0.1em solid black; | ||
margin-bottom: 2em; | ||
padding: 0 0 0.5em; | ||
} | ||
|
||
.menu:before { | ||
content: "["; | ||
} | ||
|
||
.menu:after { | ||
content: "]"; | ||
} | ||
|
||
.menu > li { | ||
display: inline; | ||
} | ||
|
||
.menu > li:before { | ||
content: "|"; | ||
padding-right: 0.3em; | ||
} | ||
|
||
.menu > li:nth-child(1):before { | ||
content: ""; | ||
padding: 0; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype html> | ||
<html xmlns:ng="http://angularjs.org/"> | ||
<head> | ||
<title>my angular app</title> | ||
<link rel="stylesheet" href="css/app.css"/> | ||
</head> | ||
<body style="display:none" ng:show="true"> | ||
<ul class="menu"> | ||
<li><a href="#/view1">view1</a></li> | ||
<li><a href="#/view2">view2</a></li> | ||
</ul> | ||
|
||
<ng:include src="$route.current.template" scope="$route.current.scope"></ng:include> | ||
|
||
<script src="lib/angular/angular.js" ng:autobind></script> | ||
<script src="js/services.js"></script> | ||
<script src="js/controllers.js"></script> | ||
<script src="js/filters.js"></script> | ||
<script src="js/widgets.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* App Controllers */ | ||
|
||
|
||
function MyCtrl1() {} | ||
MyCtrl1.$inject = []; | ||
|
||
|
||
function MyCtrl2() { | ||
} | ||
MyCtrl1.$inject = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* http://docs.angularjs.org/#!angular.filter */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* http://docs.angularjs.org/#!angular.service */ | ||
|
||
/** | ||
* App service which is responsible for the main configuration of the app. | ||
*/ | ||
angular.service('myAngularApp', function($route, $location, $window) { | ||
|
||
$route.when('/view1', {template: 'partials/partial1.html', controller: MyCtrl1}); | ||
$route.when('/view2', {template: 'partials/partial2.html', controller: MyCtrl2}); | ||
|
||
$route.onChange(function() { | ||
if ($location.hash === '') { | ||
$location.updateHash('/view1'); | ||
this.$eval(); | ||
} else { | ||
$route.current.scope.params = $route.current.params; | ||
$window.scrollTo(0,0); | ||
} | ||
}); | ||
|
||
}, {$inject:['$route', '$location', '$window'], $creation: 'eager'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* http://docs.angularjs.org/#!angular.widget */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Content-Type: multipart/related; boundary="_" | ||
--_ | ||
Content-Location:img0 | ||
Content-Transfer-Encoding:base64 | ||
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7 | ||
--_ | ||
Content-Location:img1 | ||
Content-Transfer-Encoding:base64 | ||
R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipY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CgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA== | ||
--_-- | ||
*/ | ||
(function(){ | ||
var jsUri = document.location.href.replace(/\/[^/]+(#.*)?$/, '/') + document.getElementById('ng-ie-compat').src; | ||
var css = '#ng-callout .ng-arrow-left{*background-image:url("mhtml:' + jsUri + '!img0")}#ng-callout .ng-arrow-right{*background-image:url("mhtml:' + jsUri + '!img1")}.ng-input-indicator-wait {*background-image:url("mhtml:' + jsUri + '!img2")}' | ||
var s = document.createElement('style'); | ||
s.setAttribute('type', 'text/css'); | ||
if (s.styleSheet) { | ||
s.styleSheet.cssText = css; | ||
} else { | ||
s.appendChild(document.createTextNode(css)); | ||
} | ||
document.getElementsByTagName('head')[0].appendChild(s); | ||
})(); |
Oops, something went wrong.