Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. angular.module("myApp", ['ngRoute'])
  2. .controller('myCtrl', myCtrl)
  3. .controller('common', common)
  4. .config('configuration', configuration)
  5. .factory('cprPostService', cprPostService);
  6.  
  7. function cprPostService($http) {
  8. var promise;
  9. //params need to pass -url,json object and loading alert message
  10. var cprPostService = {
  11. postJsonService: function(url,jsonObj) {
  12.  
  13. var reqData = "reqData="+jsonObj;
  14. promise = $http({
  15. method: 'POST',
  16. url:url,
  17. data: 'reqData='+jsonObj,
  18. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  19. }).success(function(data, status, headers, config) {
  20.  
  21. }).error(function(data, status, headers, config) {
  22. // alert("Error :: "+data);
  23. });
  24. // Return the promise to the controller
  25. return promise;
  26. }
  27. };
  28. return cprPostService;
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement