committing what I have for Nathan to continue

This commit is contained in:
Michael Q Larson
2015-01-09 18:09:49 -08:00
parent 3e7da5ae98
commit 02eb3b5914
3 changed files with 33 additions and 9 deletions

View File

@@ -60,6 +60,12 @@ profileValidation.controller('emailSignUpController', ['$scope',
}
]);
profileValidation.controller('emailSignInController', ['$scope',
function($scope) {
}
]);
profileValidation.directive('uniqueUsername', function($http) {
return {
restrict: 'A',
@@ -79,10 +85,22 @@ profileValidation.directive('uniqueUsername', function($http) {
};
});
profileValidation.controller('emailSignInController', ['$scope',
function($scope) {
}
]);
profileValidation.directive('uniqueEmail', function($http) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind("keyup", function (event) {
ngModel.$setValidity('unique', true);
if (element.val()) {
console.log(encodeURIComponent(element.val()));
$http.get("/api/checkUniqueEmail/" + encodeURIComponent(element.val())).success(function (data) {
if (data) {
ngModel.$setValidity('unique', false);
}
});
}
});
}
};
});