AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page
applications. Its goal is to augment browser-based applications with model-view-controller (MVC) capability,
in an effort to make both development and testing easier.
The library reads in HTML that contains additional custom tag attributes; it then obeys the directives in
those custom attributes, and binds input or output parts of the page to a model represented by standard JavaScript
variables. The values of those JavaScript variables can be manually set, or retrieved from static or dynamic JSON
resources.
The latest Angular.js version can be downloaded from:
http://angularjs.org/
Using angular-seed
Information
Anguar-seed is a starting point to create small angular-seed applications.
It has some basic file organizations and contains a basic node server.
It was created by the AngularJS team.
Operating system used
Windows Vista Home Premium SP 2
Software prerequisites
Node.js 0.10.11
Procedure
- Goto https://github.com/angular/angular-seed and download file
angular_seed_master.zip
- angular-seed needs karma. Open a dos window and type:
npm install karma -g
- Unzip this file, for example:
c:\angular-seed-master
- Make the following changes (<install_dir> = c:\angular-seed-master):
- File: <install_dir>\scripts\web-server.js
- If port number 8000 is already in use on your environment, change it to something else:
var DEFAULT_PORT = 8000
- If you use angular-seed on a windows environment, comment out the first line by adding two
forward slashes.
//#!/usr/bin/env node
- Delete all files in directories:
- <install_dir>\test\unit
- <install_dir>s\test\e2e
- Goto http://twitter.github.io/bootstrap/
and download and unzip the bootstrap package.
Several files from the boostrap package will be used in the angular-seed project.
- Copy file bootstrap.min.css to <install_dir>\app\css
- Copy files glyphicons-halflings.png and glyphicons-halflings-white.png to
<install_dir>\app\img
- Copy files bootstrap.js and bootstrap.min.js to
<install_dir>\\app\lib
- Goto http://jquery.com/download/
and download jquery-1.10.2.min.js.
Copy file jquery-1.10.2.min.js to <install_dir>\app\lib
- Goto http://underscorejs.org/
and download underscore-min.js.
Copy file underscore-min.js to <install_dir>\app\lib
- Delete files:
- <install_dir>\app\index.html
- <install_dir>\app\index-async.html
- Delete direcotory <install_dir>\app\partials
- Create files:
- Make the following changes:
- Update file <install_dir>\app\js\app.js
- Delete file <install_dir>\app\js\controller.js
- Create directory <install_dir>\app\js\controllers
- Update file <install_dir>\app\js\directives.js
- Update file <install_dir>\app\js\filters.js
- Delete file <install_dir>\app\js\services.js
- The directory <install_dir>\scripts contains start up scripts:
- test.bat - to run the unit tests
- The unit tests are located in directory:
<install_dir>\test\unit
- The configuration file for the unit tests:
<install_dir>\config\karma.conf.js
- e2e-test.bat - to run the end-to-end tests
- The end-to-end tests are located in directory:
<install_dir>\test\e2e
- The configuration file for the end-to-end tests:
<install_dir>\config\karma-e2e.conf.js
To run these scripts:
- Goto <install_dir>
- Type: scripts\test.bat
- Type: scripts\e2e-test.bat
- To launch the node server included in the angular-seed package:
- Goto <install_dir>
- Type: node scripts\web-server.js
- Open browser and type: http://localhost:8000/
Note: If you have previously change the port number, use the new port number in the URL.
- The modified angular seed project can be used for future small projects or for tutorial purposes.
|
|