I am trying to call two different functions using ng-click="Reset();Search()"
But it isn't working. Is this the correct way of using ng-click for multiple functions?
Asked
Active
Viewed 529 times
0

beginner
- 303
- 1
- 10
- 31
-
http://stackoverflow.com/questions/16813945/how-to-add-many-functions-in-one-ng-click – Ajay Singh Apr 07 '17 at 07:33
-
provide your html and controller – Sachila Ranawaka Apr 07 '17 at 07:35
-
But this particular solution is not working for me. I have already referred that question – beginner Apr 07 '17 at 07:35
-
add your html and js part – Apr 07 '17 at 07:39
-
This should work though. Provide your js code. – SinDeus Apr 07 '17 at 07:50
1 Answers
0
Your html should look something like this (vm for 'controller'):
<a ng-click="vm.multipleMethodCalls()">link text</a>
Your controller should have the method (ES5 code style) which calls two other (or more if you want) methods:
function multipleMethodCalls() {
this.Reset();
this.Search();
}
What you do NOT want to do is litter the templates with more and more code and logic. Remember the saying 'KISS', Keep It Simple Stupid, the simpler the better. Moving your logic into the controller is easy to understand and allows you a little more control.

rrd
- 5,789
- 3
- 28
- 36