Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //controller.js
- 'use strict';
- angular.module('Contact')
- .controller('ContactController',
- ['$scope',
- function ($scope) {
- /* $scope.ShowUser = function () {
- HomeService.GetLoggedUser(function (response) {
- if (response.success) {
- $scope.username = response.data.username;
- console.log($scope.username);
- } else {
- $scope.error = response.message;
- }
- });
- };*/
- $scope.contact = function () {
- $scope.dataLoading = true;
- ContactService.SendMessage( function (response) {
- if (response.success) {
- $scope.contactBame = response.data.contactName;
- console.log($scope.contactName);
- $scope.dataLoading = false;
- } else {
- $scope.error = response.message;
- $scope.dataLoading = false;
- }
- })
- }
- ]);
- //services.js
- 'use strict';
- angular.module('Registration')
- .factory('RegistrationService', ['$http', function ($http) {
- var service = {};
- service.Register = function (u, p, callback) {
- $http.post('/register', {username: u, password: p})
- .then(
- function (data) {
- callback({success: true, message: 'Registration completed'});
- }, function (error) {
- callback({success: false, message: 'Error occured during registration'});
- });
- }
- return service;
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement