Angular
is an open source project licensed under the MIT license. Your contributions are
always welcome. When working with angular
source base, please follow the guidelines provided on
this page.
Angular
We'd love for you to contribute to our source code and to make angular
even better than it is
today! Here are the guidelines we'd like you to use:
To ensure consistency throughout the source code, keep these rules in mind as you are working:
@ngdoc
tag). To see how we document our APIs, please
check out the existing ngdocs.With the exceptions listed below, we follow the rules contained in Google's JavaScript Style Guide:
angular
code base in an anonymous closure
and export our API explicitly rather than implicitly.angular
. The best guidance is to do what makes the most sense.The angular
source code is hosted at Github, which we also use to
accept code contributions. Several steps are needed to check out and build angular
:
Before you can build angular
, you must install or configure the following dependencies on your
machine:
angular
source base, which means there is no need to install or configure it separately.To create a Github account, follow the instructions here. Afterwards, go ahead and fork the main angular repository.
Angular
To build angular
, you check out the source code and use Rake to generate the non-minified and
minified angular
files:
To clone your Github repository, run:
git clone git@github.com:<github username>/angular.js.git
To go to the angular
directory, run:
cd angular.js
To add the main angular
repository as an upstream remote to your repository, run:
git remote add upstream https://github.com/angular/angular.js.git
To build angular
, run:
rake package
The build output can be located under the build
directory. It consists of the following files and
directories:
angular-x.y.z-<git sha>.tgz
— This is the complete tarball, which contains all of the release
build artifacts.angular.js
— The non-minified angular
script.angular.min.js
— The minified angular
script.angular-scenario.js
— The angular
End2End test runner.angular-ie-compat.js
— The Internet Explorer compatibility patch file.docs/
— A directory that contains all of the files needed to run docs.angularjs.org
.docs/index.html
— The main page for the documentation.docs/docs-scenario.html
— The End2End test runner for the documentation application.To debug or test code, it is often useful to have a local HTTP server. For this purpose, we have made available a local web server based on Node.js.
To start the web server, run:
./nodeserver.sh
To access the local server, go to this website:
http://localhost:8000/
By default, it serves the contents of the angular
project directory.
Our unit and integration tests are written with Jasmine and executed with JsTestDriver. To run the tests:
To start the JSTD server, run:
./server.sh
To capture one or more browsers, go to this website:
http://localhost:9876/
To trigger a test execution, run:
./test.sh
To automatically run the test suite each time one or more of the files in the project directory
is changed, you can install watchr
and then run:
watchr watchr.rb
To view the output of each test run, you can tail this log file:
./logs/jstd.log
To run the End2End test suite:
In a browser, go to:
http://localhost:8000/build/docs/docs-scenario.html
The tests are executed automatically.
To create and submit a change:
Create a new branch off the master for your changes:
git branch my-fix-branch
Check out the branch:
git checkout my-fix-branch
Create your patch, make sure to have plenty of tests (that pass).
Commit your changes:
git commit -a
Run JavaScript Lint and be sure to address all new warnings and errors:
rake lint
Push your branch to Github:
git push origin my-fix-branch
In Github, send a pull request to angular:master
.
When the patch is reviewed and merged, delete your branch and pull yours — and other — changes from the main (upstream) repository:
To delete the branch in Github, run:
git push origin :my-fix-branch
To check out the master branch, run:
git checkout master
To delete a local branch, run:
git branch -D my-fix-branch
To update your master with the latest upstream version, run:
git pull --ff upstream master
That's it! Thank you for your contribution!