Advertisement
Guest User

Untitled

a guest
May 29th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. //controller.js
  2. 'use strict';
  3.  
  4. angular.module('Contact')
  5.  
  6. .controller('ContactController',
  7. ['$scope',
  8. function ($scope) {
  9. /* $scope.ShowUser = function () {
  10. HomeService.GetLoggedUser(function (response) {
  11. if (response.success) {
  12. $scope.username = response.data.username;
  13. console.log($scope.username);
  14. } else {
  15. $scope.error = response.message;
  16. }
  17. });
  18. };*/
  19. $scope.contact = function () {
  20. $scope.dataLoading = true;
  21. ContactService.SendMessage( function (response) {
  22. if (response.success) {
  23. $scope.contactBame = response.data.contactName;
  24. console.log($scope.contactName);
  25.  
  26. $scope.dataLoading = false;
  27. } else {
  28. $scope.error = response.message;
  29. $scope.dataLoading = false;
  30. }
  31. })
  32.  
  33.  
  34.  
  35. }
  36. ]);
  37.  
  38. //services.js
  39.  
  40. 'use strict';
  41.  
  42. angular.module('Registration')
  43.  
  44. .factory('RegistrationService', ['$http', function ($http) {
  45. var service = {};
  46. service.Register = function (u, p, callback) {
  47. $http.post('/register', {username: u, password: p})
  48. .then(
  49. function (data) {
  50. callback({success: true, message: 'Registration completed'});
  51. }, function (error) {
  52. callback({success: false, message: 'Error occured during registration'});
  53. });
  54. }
  55. return service;
  56. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement