title: Calling angularjs Function Using Next and previous button
body: <p>Hai Everyone....
             Is there any way to call Angular function using Next and Previous Button....?
    i have four function fun1,fun2,fun3,fun4...When page loads fun1 should be called..if i click on next button means fun2 should be call..if i click again next button then fun3 should be call similarly fun4....
      In the same way if i click previous button means it should call previous function... for example...fun2 to fun1 similarly for other function also....</p>
  
  <p>please Help me to find out solution for this....
  Thank You....</p>
  
  <p>I have Used ng-hide and ng-show based on my requirement....to show particular div like Request Address comments and  Bank Details...</p>
  
  <p>And in the above of my page i provided four button like Request Address Comments and Bank Details if the user click on Request then the Request div shown...similarly for others also...and it will work fine...
    But the requirement is slightly changed instead of clicking on particular button we have to give next and previous button to activate the div..
  Below i added my code please verify it.</p>
  
  <p>This code shows four button on top of my web page....</p>
  
  <pre><code>&lt;div class="row btn-group" style="width:50%;margin-left: 0px" ng-init="style={'background-color' : 'green'};yash={'background-color' : 'green'}"&gt;
    &lt;div&gt;
     &lt;div class="col-md-3"&gt;
    &lt;button type="button" class="btn btn-primary" style="background-color: green"; ng-style="style1" ng-click="requestEditbtn();style1=style;style2=null;style3=null;style4=null"
    &gt;Request&lt;/button&gt;
    &lt;/div&gt;
    &lt;div class="col-md-3"&gt;
    &lt;button type="button" class="btn btn-primary" ng-style="style2"ng-click="addressEditbtn();style2=style;style1=null;style3=null;style4=null"&gt;Address&lt;/button&gt;
    &lt;/div&gt;
      &lt;div class="col-md-3"&gt;
        &lt;button type="button" class="btn btn-primary" ng-style="style3" ng-click="commentEditbtn();style3=style;style1=null;style2=null;style4=null";&gt;Comments&lt;/button&gt;
      &lt;/div&gt;
    &lt;div class="col-md-3"&gt;
        &lt;button type="button" class="btn btn-primary" ng-style="style4" ng-click="bankEditbtn();style4=style;style1=null;style2=null;style3=null"&gt;BankDetails&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>This code shows the particular div on button click</p>
  
  <pre><code>&lt;div class="container-fluid" ng-cloak&gt;
    &lt;form name="RequestForm"&gt;
      &lt;div class="Request cls1" ng-hide="Request=='false'"&gt;
      &lt;div class="form-group"&gt;
        &lt;input type="text" placeholder="Requested For" ng-model="Name" maxlength="21" ng-maxlength="20" name="requestname" required id="capital"&gt;
        &lt;div ng-if="RequestForm.requestname.$touched || signupSubmitted"&gt;
      &lt;p ng-show="RequestForm.requestname.$error.required" class="help-block"&gt;Requester Name is Required&lt;/p&gt;
      &lt;/div&gt;
        &lt;span ng-show="!RequestForm.requestname.$error.required &amp;&amp;  RequestForm.requestname.$error.maxlength &amp;&amp; RequestForm.requestname.$dirty" class="help-block"&gt;Maximum 20 Characters&lt;/span&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
        &lt;div class="form-group col-xs-6" id="default" &gt;
         &lt;input type="text" ng-model="default" id="default" readonly&gt;
        &lt;/div&gt;
        &lt;div class="form-group col-xs-6"&gt;
      &lt;input type="text" placeholder="Mobile Number" ng-model="MobileNo" name="mobile" required ng-maxlength="10" maxlength="11" id="default1" &gt;
      &lt;div ng-if="RequestForm.mobile.$touched || signupSubmitted"&gt;
      &lt;p ng-show="RequestForm.mobile.$error.required" class="help-block"&gt; Mobile No is Required&lt;/p&gt;
      &lt;/div&gt;
  
        &lt;span ng-show="!RequestForm.mobile.$error.required &amp;&amp;  RequestForm.mobile.$error.maxlength &amp;&amp; RequestForm.mobile.$dirty" class="help-block"&gt;Maximum 10 Number&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div&gt;
        &lt;p id="label"&gt;Firm Code:&lt;/p&gt;
            &lt;select ng-model="DeptName" ng-change="productFetch(DeptName)"&gt;
                 &lt;option ng-repeat = "newdeptname in deptname"&gt;{{newdeptname.FirmCode}}&lt;/option&gt;
            &lt;/select&gt;     
      &lt;/div&gt;
      &lt;div class="clear-fix"&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;
        &lt;div&gt;
        &lt;p id="label"&gt;Products:&lt;/p&gt;
            &lt;select ng-model="yash" &gt;
              &lt;option&gt;--select--&lt;/option&gt;
                 &lt;option ng-repeat = "yash in yashwanth"&gt;{{yash.ProductName}}&lt;/option&gt;
            &lt;/select&gt;     
      &lt;/div&gt;&lt;br&gt;
      &lt;div class="form-group"&gt;
        &lt;input type="text" placeholder="Amount" ng-model="Amount" required ng-maxlength="20" maxlength="21" name="amount" requried&gt;
      &lt;div ng-if="RequestForm.amount.$touched || signupSubmitted"&gt;
      &lt;p ng-show="RequestForm.amount.$error.required" class="help-block"&gt; Amount is Required&lt;/p&gt;
      &lt;/div&gt;
  
        &lt;span ng-show="!RequestForm.amount.$error.required &amp;&amp;  RequestForm.amount.$error.maxlength &amp;&amp; RequestForm.amount.$dirty" class="help-block"&gt;Maximum 20 Number&lt;/span&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;input type="text" placeholder="Request Purpose" ng-model="RequestPurpose" name="purpose" required ng-maxlength="20" maxlength="21"&gt;
      &lt;div ng-if="RequestForm.purpose.$touched || signupSubmitted"&gt;
      &lt;p ng-show="RequestForm.purpose.$error.required" class="help-block"&gt; Request Purpose is Required&lt;/p&gt;
      &lt;/div&gt;
  
        &lt;span ng-show="!RequestForm.purpose.$error.required &amp;&amp;  RequestForm.purpose.$error.maxlength &amp;&amp; RequestForm.purpose.$dirty" class="help-block"&gt;Maximum 20 Charactersxd&lt;/span&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="Comments cls2" ng-show="Comments=='true'"&gt; 
      &lt;div class="form-group"&gt;
        &lt;textarea rows="4" cols="50" placeholder="Enter Comments Here" ng-model="jaiGanesh" name="comments" required ng-maxlength="200" maxlength="201"&gt;&lt;/textarea&gt;
  
      &lt;div ng-if="RequestForm.comments.$touched || signupSubmitted"&gt;
      &lt;p ng-show="RequestForm.comments.$error.required" class="help-block"&gt; Comment is Required&lt;/p&gt;
      &lt;/div&gt;      
        &lt;span ng-show="!RequestForm.comments.$error.required &amp;&amp;  RequestForm.comments.$error.maxlength &amp;&amp; RequestForm.comments.$dirty" class="help-block"&gt;Maximum 200 Characters&lt;/span&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Similarly for other div also....</p>
  
  <p>Here is the controller code to hide and show the particular div....</p>
  
  <pre><code>$scope.requestEditbtn=function(Request)
  {
   $scope.Request="true";
   $scope.Address="false";
   $scope.Comments="false";
   $scope.Bank="false";
  }
  $scope.addressEditbtn=function(Address)
  {
  $scope.Request="false";
  $scope.Address="true";
  $scope.Comments="false";
  $scope.Bank="false";
  }
  $scope.commentEditbtn=function(Address)
  {
   $scope.Comments="true";
   $scope.Address="false";
   $scope.Request="false";
   $scope.Bank="false";
   }
  
  $scope.bankEditbtn=function(Address)
  {
   $scope.Comments="true";
   $scope.Address="false";
   $scope.Request="false";
   $scope.Bank="false";
  }
  </code></pre>
  
  <p>UI
  <a href="https://i.stack.imgur.com/N1NVQ.png" rel="nofollow noreferrer">Screen shot of my web page</a></p>