/angularjsapp

Primary LanguageCSSMIT LicenseMIT

Angular Js Portal

This Project is a Test Demo AngularJs Application

Getting Started

To get you started you can simply clone the angularjsapp repository and install the dependencies:

Run the Application

npm start

Now browse to the app at [localhost:8000]

Running Unit Tests

The angular-seed app comes preconfigured with unit tests. These are written in [Jasmine][jasmine], which we run with the [Karma][karma] test runner. We provide a Karma configuration file to run them.

  • The configuration is found at karma.conf.js.
  • The unit tests are found next to the code they are testing and have an _test.js suffix (e.g. view1_test.js).

The easiest way to run the unit tests is to use the supplied npm script:

Updating Angular

Since the Angular framework library code and tools are acquired through package managers (npm and bower) you can use these tools to easily update the dependencies. Simply run the preconfigured script:

npm run update-deps

Serving the Application Files

While Angular is client-side-only technology and it is possible to create Angular web apps that do not require a backend server at all, we recommend serving the project files using a local web server 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 the file:// scheme instead of http://.

Running the App during Development

The angular-seed project comes preconfigured with a local development web server. It is a Node.js tool called [http-server][http-server]. 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 a folder by running:

http-server -a localhost -p 8000

Alternatively, you can choose to configure your own web server, such as Apache or Nginx. Just configure your server to serve the files under the app/ directory.

Running the App in Production

This really depends on how complex your app is and the overall infrastructure of your system, but the general rule is that all you need in production are the files under the app/ directory. Everything else should be omitted.

Angular apps are really just a bunch of static HTML, CSS and JavaScript files that need to be hosted somewhere 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 web server(s).

Continuous Integration

Travis CI

[Travis CI][travis] is a continuous integration service, which can monitor GitHub for new commits to your repository and execute scripts such as building the app or running tests. The angular-seed project contains a Travis configuration file, .travis.yml, which will cause Travis to run your tests when you push to GitHub.

You will need to enable the integration between Travis and GitHub. See the [Travis website][travis-docs] for instructions on how to do this.