JavaScript Angular form validation with skip some fields angular form validation example,angular form validation on submit,angular

I have a page which has a form in it named as profile updation and when a user comes to this page for any updation of his profile that time he only update 1 or 2 fields so every time form checks the form is valid or not then only saves in db, but I want to save if password and confirm password fields are not updated then also update his profile, but also when he wants to change password that time save button will get disabled and checks validation after that update the profile.

Means when user update only name that time also update the profile and also user update the password that time first check validation and then update the profile.

Save and isValid check:

app.controller('DemoCtrl', function($scope, $http) {
 $scope.saveProfile = function(){
            if($scope.profile.$valid){
                ngProgress.start();
                user.saveProfile($scope.currentUser.details,function(response){
                    angular.copy(response,shared.data.currentUser);
                    notification.success($filter("il8n")("_ProfileUpdateMessage_"));
                    ngProgress.done();
                });
            }
        }

   $scope.isValidForm = function(){

            //if(($scope.profile.confirmpassword && $scope.profile.newpassword && $scope.profile.newpassword.$modelValue !== $scope.profile.confirmpassword.$modelValue))
            //    return true;
            if(!$scope.profile.$valid){
               if(($scope.profile.confirmpassword && $scope.profile.newpassword && $scope.profile.confirmpassword.$modelValue && $scope.profile.newpassword.$modelValue && ($scope.profile.newpassword.$modelValue.length == 0 || $scope.profile.confirmpassword.$modelValue.length == 0))){
                   return false;
               }
                if(($scope.profile.confirmpassword && $scope.profile.newpassword && $scope.profile.confirmpassword.$modelValue && $scope.profile.newpassword.$modelValue && $scope.profile.newpassword.$modelValue ===  $scope.profile.confirmpassword.$modelValue)){
                    return false;
                }
            }
            if($scope.profile.$valid && $scope.profile.$dirty)
                return false;

            if($scope.profile.newpassword.$invalid || $scope.profile.newpassword.$dirty &&  $scope.profile.confirmpassword.$invalid || $scope.profile.confirmpassword.$dirty){
                //$scope.profile.newpassword.$valid;
                //$scope.profile.confirmpassword.$valid;
                return false;
            }
            //if($scope.profile.newpassword.empty &&  $scope.profile.confirmpassword.empty ){
            //   return true;
            //}
            return true;
        }      
 });

Find plnkr here.

Answer:1

One part of the currently developed Web Components specification is that one will be able to create one's own HTML element, e.g. by calling the new document.register. An example is given here: https://...

One part of the currently developed Web Components specification is that one will be able to create one's own HTML element, e.g. by calling the new document.register. An example is given here: https://...

  1. inheriting components in angular

Newbie jQuery / Javascript question here I see functions written in the following fashion: some_function = function(event) { } My question is: What is meant by that event argument? Is it optional? ...

Newbie jQuery / Javascript question here I see functions written in the following fashion: some_function = function(event) { } My question is: What is meant by that event argument? Is it optional? ...

  1. javascript jquery function
  2. javascript jquery function example
  3. javascript jquery function call
  4. javascript jquery function is not defined
  5. javascript jquery function return value
  6. javascript jquery function callback
  7. js jquery function
  8. javascript function jquery parameter
  9. jquery javascript function string
  10. javascript onclick jquery function
  11. javascript call jquery function onclick
  12. javascript inside jquery function
  13. javascript run jquery function
  14. javascript execute jquery function
  15. javascript jquery click function
  16. javascript jquery each function
  17. javascript jquery exit function
  18. javascript override jquery function
  19. javascript jquery init function
  20. javascript jquery extend function

I'm using JQuery DataTable with server side processing. And I've written this code: public List<VacationRequest> GetVacationRequestsWithProfiles(int displayStart, int displayLength, out int ...

I'm using JQuery DataTable with server side processing. And I've written this code: public List<VacationRequest> GetVacationRequestsWithProfiles(int displayStart, int displayLength, out int ...

  1. jquery datatable default sort
  2. jquery datatable default page length
  3. jquery datatable default page size
  4. jquery datatable default sort disable
  5. jquery datatable default search value
  6. jquery datatable default value
  7. jquery datatable default page number
  8. jquery datatable default row count
  9. jquery datatable default column sort
  10. jquery datatable default show entries
  11. jquery datatable default length
  12. jquery datatable default filter
  13. jquery datatable default content
  14. jquery datatable default rows
  15. jquery datatable default dom
  16. jquery datatable default parameters
  17. jquery datatable default sort not working
  18. jquery datatable default entries
  19. jquery datatable default search
  20. jquery datatable default search not working

I'm trying to integrate a React application (using react-router) into an existing Angular website. I've wrapped the React app up in an Angular directive which loads scripts and renders the React app ...

I'm trying to integrate a React application (using react-router) into an existing Angular website. I've wrapped the React app up in an Angular directive which loads scripts and renders the React app ...