How to set required field to not required in angular controller after the form passed to controller

I have set ng-required="valid" to true in controller and In html after passing form from the click event (ex :saveData(form)) in the saveData() method based on condition i set $scope.valid= false and need to check the form.$valid.

However setting $scope.valid = false, does not modify the form ng-required attributes i have settled to true initially.

<form name="customForm" noValidate>
    <input type="text" ng-required="valid"/>
    <button ng-click ="saveData(customForm)"></button>
</form>

in Controller

$scope.valid = true;

$scope.saveData = function(form){
  $scope.valid = false;
  if(form.$valid){
   // ng-required values set to false and take action
  }
}

Source: AngularJS