Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created January 13, 2014 04:17
Show Gist options
  • Save robwormald/8394614 to your computer and use it in GitHub Desktop.
Save robwormald/8394614 to your computer and use it in GitHub Desktop.
var resolutionSystem = angular
.module('resolutionSystem', ['ui.router'])
.controller('createCaseCtrl', function($scope,Cases){
//call this from your button
$scope.saveNewCase = function(){}
Cases.createNew($kase).then(function(_savedCase){
console.log(_savedCase)
})
};
});
resolutionSystem.controller('caseFeedCtrl', function($scope,Cases){
$scope.loadCases = Cases.getPresentCaseFeed().then(function(cases){
$scope.presentCases = cases;
})
});
resolutionSystem.factory('Cases', function($http){
return {
getPresentCaseFeed: function() {
//this returns a promise you can handle in the controller
return $http({method: 'GET', url: '/presentCaseFeed'});
},
createNew : function(newCaseObject){
//this returns a promise you can handle in the controller
return $http({method: 'POST', url: '/createCase', data: newCaseObject});
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment