且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Angularjs检查值是否在数组列表中退出

更新时间:2022-10-23 08:06:10

scope.Validate = function(){


scope.Email = {};


http.get(' index.php / Welcome / EmailCheck')。success(function(result) ){


$scope.Validate = function () {
               $scope.Email = {};
               $http.get('index.php/Welcome/EmailCheck').success(function (result) {

                   $scope.Email = result;

                   console.log(result);

               });

           };
           $scope.submitForm = function () {

               if ($scope.Email.Email === $scope.user.Email) {
                   console.log("Mail Id Alresdy Exists");
               }
               else
               {
                   $http({
                       method: 'POST',
                       url: 'index.php/Welcome/Signup',
                       data: $scope.user,
                       headers: {'Content-Type': 'application/x-www-form-urlencode'}
                   }).success(function (data) {
                       $scope.Enquiry = data;
                       console.log(data);
                       $location.path('/EnquiryResponse');
                   });
               }
               ;
           };



in Validate function $scope.Email getting all Email ids from database and it is a arraylist,
in Submitform function i got a single Email Id from ui i have stored the Email in $scope.user.Email.
now i want to check single Email($scope.user.Email) is Existing or not in Many Email Id($scope.Email)...

scope.Validate = function () {


scope.Email = {};


http.get('index.php/Welcome/EmailCheck').success(function (result) {