Monthly Archives: January 2013

Angularjs multiple services and Jasminejs unit testing a beginners guide

Angularjs using multiple services and Unit testing services with jasminejs

(update: 29/01/12) I have moved away from angular.module(‘ServiceName’, value( 
and instead use myServices.factory(‘ServiceName’, function(){ as I found  it did not do as I expected to.

Services are a bit harder to unit test and get configured than controllers.
Most examples have a single service or 2 services in a single file.
This is harder to maintain with source control as multiple people could be making changes on the same file.  Here is how to set up and use services in different files.

I have also included some example code on how to Unit test your angularjs service with jasperjs.

Continue reading

Angularj, URL routing and adding a controller for beginners

Angularjs and Url routing and adding a controller for beginners


This is a quick tutorial on how to add a new controller to your angularjs application.

Just started working with Angularjs.
This is the basis of adding a new controller and wiring it into angularjs.

Awesome tutorial from angularjs. AngularJS tutorial



  1. add a when to the app.js. under the $routeProvider.
  2. create the controller-weva.js file and name the controller the same as the when block.
  3. create the weva-view.html same name as in the when block to receive the controller call.
  4. add the controller-weva.js script named in the when block to the index.html
  5. visit the url from the when block.  May have to restart.

Continue reading