A command pattern implementation for AngularJS