angularjs - calling two different functions using ng-click -


i trying call 2 different functions using ng-click="reset();search()" isn't working. correct way of using ng-click multiple functions?

your html should (vm 'controller'):

<a ng-click="vm.multiplemethodcalls()">link text</a> 

your controller should have method (es5 code style) calls 2 other (or more if want) methods:

function multiplemethodcalls() {   this.reset();   this.search(); } 

what not want litter templates more , more code , logic. remember saying 'kiss', keep simple stupid, simpler better. moving logic controller easy understand , allows little more control.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -