title: Angularjs + Disable and Enable submit button
body: <p>I have sample code like this:</p>
  
  <p>Html Code:</p>
  
  <pre><code>&lt;body ng-controller="MainCtrl"&gt;
      &lt;form name="myForm"&gt;
        &lt;input name="myText" type="text" name="test" ng-model="mytext" required /&gt;
        &lt;button ng-click="save()" ng-disabled="myForm.$invalid"&gt;Save&lt;/button&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p>Js code:</p>
  
  <pre><code>var app = angular.module('angularjs-starter', []);
  
  app.controller('MainCtrl', function($scope) {
    $scope.name = 'World';
  
    $scope.save = function(){
      //logic or http method
      console.log("Test");
    }
  });
  </code></pre>
  
  <p>Attached the code in this link: <a href="http://plnkr.co/edit/O8eIGjKQapI7mpZmFIxr?p=preview" rel="nofollow noreferrer">Click Here</a></p>
  
  <p>Logic:</p>
  
  <ol>
  <li>Default save button disabled.</li>
  <li>After enter the form enable the button.</li>
  <li>After save again disable the save button.</li>
  <li>Again user enter the text need to enable save button.</li>
  </ol>
  
  <p>Note: Here I attached only one input but I have multiple input fields.
  Also, In save function I had logic data save into database.</p>