0

i am using ng-table inside a form.

    <form role="form" name="frmCommand"  class="formValidCommand" novalidate="novalidate" ng-submit="frmCommand.$valid && vm.saveCommandChanges()">

i have a clear sorting button on the table.

                <button ng-click="storeCommandsTableParams.sorting({})" class="btn btn-default pull-right">Clear sorting</button>

clicking this button is calling vm.saveCommandChanges() instead of clearing the sort.

any suggestions please?

PSL
  • 123,204
  • 21
  • 253
  • 243
Raas Masood
  • 1,475
  • 3
  • 23
  • 61

1 Answers1

0

Default type attribute value for button tag is submit, so when you click on it it will trigger its parent form's submit event which is captured by ng-submit directive. So try change it to button type so that submit event does not happen.

ie.

<button 
   type="button"
   ng-click="storeCommandsTableParams.sorting({})" 
   class="btn btn-default pull-right">Clear sorting</button>
PSL
  • 123,204
  • 21
  • 253
  • 243