I want to call same method in controller on multiple button click with different parameters. If I write different-different javascript code to handle it, works fine. But I want to use the same code for all operation... Here is html code:
Note: "breakfastCalorie" and "lunchCalorie" are available dynamic values.
<div id="breakfast">
<span> Breakfast - {{breakfastCalorie}} </span>
<button id="breakfast_btn" ng-click="suggestMeal(breakfastCalorie)">Breakfast</button>
</div>
<div id="lunch">
<span> Lunch - {{lunchCalorie}} </span>
<button id="lunch_btn" ng-click="suggestMeal(lunchCalorie)">Lunch</button>
</div>
... and so on.
And the following function should be called on each button click (or should I write same javascript again). Here is javascript line of code:
$scope.suggestMeal = function () {
//I want the calorie value to further send it to do some manipulation
}