I have a disabled button that needs to be enabled after a certain amount of time.
My attempt at using $timeout
and ng-disabled
is not producing the desired result.
Here is the HTML code:
<button id="resend_button" class="btn btn-block btn-info" ng-click="reenviar_confirmacao()" ng-disabled="!buttonEnabled">{{'RESEND-CONFIRMATION' | translate}}</button>
Modal opening function:
ngDialog.open({
id: 'confirmation',
template: '../../../templates/confirmacao-sms.html',
preCloseCallback: callback,
backdrop : 'static',
keyboard : false,
scope: $scope
});
The function to enable the button:
$timeout(function(){
console.log(angular.element("#resend_button"));
// Attempted this but didn't work either
angular.element("#resend_button").removeAttr('disabled');
$scope.buttonEnabled = true;
$scope.$apply();
}, 2000)
Although it updates the $scope.buttonEnblaed
value, the button status only refreshes when the modal is closed and reopened.