We have already talked about Jason and its role in CQRS, for an introduction you can read my original post.

In the last year I’ve been amazed by the power of AngularJS, more to come in the near future, and I decided to write a JavaScript client for Jason, obviously as an AngularJS module.

angular.module('myControllers', []);
angular.module('myApp', ['myControllers', 'jason.client']);

(function(module){

   var ctrl = function($scope, jason){

      var promise = jason.execute({
         '$type': 'my-command-type',
         sampleProperty: 'sample value'
      });

   };
   ctrl.$inject = ['$scope', 'jasonClient'];
   module.controller( 'sample', ctrl);

}(angular.module('myControllers'));

And on the server you can benefit of the whole Jason infrastructure that now can automatically generate and handle correlation ids for us.

.m