Local Angular development

How to develop AngularJS applications in offline mode.

I have been looking for ways to speed up my development cycle: edit, lint, test, play with the front end. Finally, I figured out a way to make things much smoother: develop without a backend server. The main principles for my local angular development are:

  • bring all 3rd party libraries to local disk using bower.
  • compile directive templates into JavaScript to be concatenated with the rest of the code.
  • open local file directly in the browser without even a static webserver.
  • use mock e2e http backend provided by angular-mocks to serve fake data from index.html
  • use Grunt watch task to rebuild the app and reload the browser on any change.

I created an example project on github, you can see the tiny demo live at gh-pages.

If you need more, for example have a REST data source against a mock JSON file, take a look at json-server, I described very quick prototyping using json-server and Restangular.