0

I am having table containing rows and in one column i am having two buttons approve and reject , the problem is reject button works only after the approve button. If I click on reject button it doesn't work on first time. this is my code.

      <tr ng-repeat="item in userRequests">            
                       <td style="border: 1px solid #435363;">{{$index  + 1 }}</td>
                       <td style="border: 1px solid #435363;">{{item.email_id}}</td>
                       <td ng-if="item.request_status == 0 && item.is_active == null" style="border: 1px solid #435363;">valid till: <input type="text" datepicker ng-model="validate" style="vertical-align: top;" /> <span><button type="button" style = "margin-left: 4px;margin-right: 4px;" class="btn btn-primary btn-xs" ng-click="approveUser(item.email_id,validate)">Approve</button></span>
                       <span><button type="button" class="btn btn-primary btn-xs" ng-click="rejectUser(item.email_id)">Reject</button></span></td>
     </tr>

i am not able to understand which thing is stopping the button to call the function on first click. please see the pic by clicking here the view of table

10
  • can you put console.log inside the function approveUser and reject user and comment the rest of the functionality and check if it is called ? , i believe the issue is in the functionality not this code Commented May 9, 2017 at 6:58
  • actually reject button works after i click on the approve button Commented May 9, 2017 at 7:05
  • i know that but did you try what i suggested inorder to see if it is clicked does it respond without functionality ? Commented May 9, 2017 at 8:04
  • i tried ur console method but the reject doesn't get fired when clicking the reject button on the first go. Commented May 9, 2017 at 9:52
  • ok then check this link the second answer might help stackoverflow.com/questions/16736804/… Commented May 9, 2017 at 10:45

1 Answer 1

0

first your fiddle has issues so i changed used another one check this fiddle http://jsfiddle.net/U3pVM/32109/

it is working. i also tried it on angular seed project and there was no problem but you need to change registerCtrl to controller !

app.registerCtrl('myCtrl', function($scope, $http, $rootScope) {

app.controller('myCtrl', function($scope, $http, $rootScope) {
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.