Is there a way for me to pass a value from one function to another? Here is an example of what I am trying to achieve:
HTML
<div>
<li ng-repeat="language in languages" ng-click="myFirstFunction(firstValue)
{{language.lang}}
</li>
</div>
<div>
<li ng-repeat="age in agess" ng-click="mySecondFunction(secondValue)
{{age.year}}
</li>
</div>
JS
$scope.myFirstFunction = function (firstValue) {
console.log(firstValue);
}
$scope.mySecondFunction = function (secondValue) {
console.log(secondValue);
}
$scope.myThirdFunction = function () {
$scope.myFirstFunction(firstValue) // I need to access this value inside myThirdFunction()
$scope.mySecondFunction(secondValue) // I need to access this value inside myThirdFunction()
// console.log(firstValue);
// console.log(secondValue)
}
I have two separate functions because the values will come from two different clicks. How can I retrieve these values inside myThirdFunction?
Any help would be appreciated. Thank you.