SHARE
TWEET

Modeling in Angular

mero909 Jan 28th, 2016 23 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     'use strict';
  3.  
  4.     angular
  5.         .module('login')
  6.         .service('LoginModel', getInstance);
  7.  
  8.     LoginModel.$inject = ['$http'];
  9.  
  10.     function getInstance($http) {
  11.         return LoginModel;
  12.     }
  13.  
  14.     function LoginModel(data) {
  15.         var model = {
  16.             firstName: '',
  17.             lastName: '',
  18.             middleName: '',
  19.             username: '',
  20.             password: '',
  21.             emailAddress: '',
  22.             confirmEmail: '',
  23.             country: '',
  24.             isExistingUser: false
  25.         };
  26.  
  27.         angular.extend(this, model, data || {});
  28.     }
  29.  
  30.     LoginModel.prototype.getServerMapping = function () {
  31.         return {
  32.             FirstName: this.firstName,
  33.             LastName: this.lastName,
  34.             MiddleName: this.middleName,
  35.             Username: this.username,
  36.             Password: this.password,
  37.             EmailAddress: this.emailAddress,
  38.             ConfirmEmail: this.confirmEmail,
  39.             Country: this.country,
  40.             IsExistingUser: this.isExistingUser
  41.         };
  42.     };
  43. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top