This project is an application skeleton for a typical AngularJS web app. You can use it to quickly bootstrap your angular webapp projects and dev environment for these projects.
The depth=1
tells git to only pull down one commit worth of historical data.
We have two kinds of dependencies in this project: tools and AngularJS framework code. The tools help us manage and test the application.
- We get the tools we depend upon and the AngularJS code via
npm
, the Node package manager. - In order to run the end-to-end tests, you will also need to have the Java Development Kit (JDK) installed on your machine. Check out the section on end-to-end testing for more info.
We have preconfigured npm
to automatically copy the downloaded AngularJS files to app/lib
so we
can simply do:
npm install
Behind the scenes this will also call npm run copy-libs
, which copies the AngularJS files and
other front end dependencies. After that, you should find out that you have two new directories in
your project.
node_modules
- contains the npm packages for the tools we needapp/lib
- contains the AngularJS framework files and other front end dependencies
Note copying the AngularJS files from node_modules
to app/lib
makes it easier to serve the
files by a web server.
We have preconfigured the project with a simple development web server. The simplest way to start this server is:
npm start
Now browse to the app at localhost:8000/index.html
.
app/ --> all of the source files for the application
app.css --> default stylesheet
core/ --> all app specific modules
version/ --> version related components
version.js --> version module declaration and basic "version" value service
version_test.js --> "version" value service tests
version-directive.js --> custom directive that returns the current app version
version-directive_test.js --> version directive tests
interpolate-filter.js --> custom interpolation filter
interpolate-filter_test.js --> interpolate filter tests
view1/ --> the view1 view template and logic
view1.html --> the partial template
view1.js --> the controller logic
view1_test.js --> tests of the controller
view2/ --> the view2 view template and logic
view2.html --> the partial template
view2.js --> the controller logic
view2_test.js --> tests of the controller
app.js --> main application module
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
e2e-tests/ --> end-to-end tests
protractor-conf.js --> Protractor config file
scenarios.js --> end-to-end scenarios to be run by Protractor
karma.conf.js --> config file for running unit tests with Karma
package.json --> Node.js specific metadata, including development tools dependencies
package-lock.json --> Npm specific metadata, including versions of installed development tools dependencies
npm test
npm run test-single-run
npm start
npm run update-webdriver
Once you have ensured that the development web server hosting our application is up and running, you can run the end-to-end tests using the supplied npm script:
npm run protractor
This script will execute the end-to-end tests against the application being hosted on the development server.
Since the AngularJS framework library code and tools are acquired through package managers (e.g. npm) you can use these tools to easily update the dependencies. Simply run the preconfigured script:
npm run update-deps
This will call npm update
and npm run copy-libs
, which in turn will find and install the latest
versions that match the version ranges specified in the package.json
file.
If you want to update a dependency to a version newer than what the specificed range would permit,
you can change the version range in package.json
and then run npm run update-deps
as usual.
npm run update-index-async
You can start this web server with npm start
, but you may
choose to install the tool globally:
sudo npm install -g http-server
Then you can start your own development web server to serve static files from any folder by running:
http-server -a localhost -p 8000
For more information on AngularJS please check out angularjs.org.