Here is the code snippet for the controller functions related to payment status.
$scope.userhold_payment = function() {
$http.get('http://localhost/ngaffiliate/api/payment/change_hold_payment_status')
.then(function(response) {
console.log('User hold payment called');
$scope.userhold = response.data;
});
};
$scope.check_status = function() {
$http.get('http://localhost/ngaffiliate/api/payment/check_payment_status')
.then(function(response) {
console.log('Check payment status called');
$scope.checkstatus = response.data;
console.log(response);
console.log($scope.checkstatus.is_hold_payment);
});
}
Below is a section from main.html which triggers these functions:
<div ng-init="check_status()">
<button type="button" ng-click="userhold_payment()" class="btn-success btn-lg hold_payment_html" style="margin-top:7px; font-size:16px">Hold Payment</button>
</div>
I am looking for help on how to initialize the check_status() function upon reloading and trigger the userhold_payment() function only when the button is clicked. Thanks in advance!