Kim Sean Kim Sean - 3 months ago 15
AngularJS Question

angularjs ngclick dealing with two function

Help make angularjs ng click dealing with two functions. I tried but it is not working. theshowtakeorder shows and hide a div and the takeorderfunction must execute a function from the controller.

<button ng-click="takeorderfunction() showtakeorder = !showtakeorder">TAKE ORDER</button>

Answer

Try with a semi-colon:

<button ng-click="takeorderfunction(); showtakeorder = !showtakeorder">TAKE ORDER</button>

Or better yet place your logic in another function:

<button ng-click="clickFunction()">TAKE ORDER</button>

controller:

$scope.clickFunction = function(){
    takeorderfunction();
    showtakeorder = !showtakeorder;
}