Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default class Email
- {
- constructor()
- {
- this.restrict = 'A'
- this.require = 'ngModel'
- }
- controller($scope, $http)
- {
- 'ngInject'
- }
- link(scope, element, attrs, ngModel)
- {
- $http.get(Configuration.api + '/data/emulator/users/match/email/' + $scope.user.email)
- .then (request => {
- if (request.data) {
- return ngModel.$setValidity('invalidEmailAvailability', false)
- } else {
- return ngModel.$setValidity('invalidEmailAvailability', true);
- }
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement