Created
January 13, 2014 04:17
-
-
Save robwormald/8394614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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