Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export default class Email
  2. {
  3.     constructor()
  4.     {
  5.         this.restrict   = 'A'
  6.         this.require    = 'ngModel'
  7.     }
  8.  
  9.     controller($scope, $http)
  10.     {
  11.         'ngInject'
  12.  
  13.     }
  14.  
  15.     link(scope, element, attrs, ngModel)
  16.     {
  17.  
  18.       $http.get(Configuration.api + '/data/emulator/users/match/email/' + $scope.user.email)
  19.         .then (request => {
  20.           if (request.data) {
  21.             return ngModel.$setValidity('invalidEmailAvailability', false)
  22.           } else {
  23.             return ngModel.$setValidity('invalidEmailAvailability', true);
  24.           }
  25.         })
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement