0

I am new to angularjs and UI dev too and I have tried to implement a functionality of disabling the button on-click of it and showing a message on page e.g "In progress" and after 3 secs button should get enabled with a different message e.g "Completed".

Button is getting disabled on click but and not showing notification "In Progress"on-click instead showing notification "Complete"after 3 secs.

I have seen this similar kind of problem solved before in this forum but not able to figure out missing logic in my code ............kindly please help

MY HTML:

Analysis

In Progress

Complete

Controller:

  $scope.isDisabled=false;
  $scope.showNotification=false;
  $scope.isEnabled=true;
  $scope.completeNotification=false; 

  $scope.showNext=function(){

       $scope.isDisabled=true;
       $scope.showNotification=true;
       $scope.buttonWait();



$scope.buttonWait = function() {
    $timeout($scope.isEnabled = true, $scope.showNotification = false, $scope.completeNotification = true, 3000);
}
3
  • Adding again html part::<div> <button class="btn btn-success btn-circle btn-xl" style="margin-bottom:4px;white-space: normal;" data-ng-click="showNextWidget();" ng-disabled="isDisabled">Analysis </button> <p class="notification-btn" ng-show="showNotification">System has started to explore the input data. Please wait until further notification!</p> <p class="notification-btn-complete" ng-hide="showNotification" ng-show="completeNotification" ng-disabled="isEnabled">Please continue with the next process!</p> </div> Commented Aug 15, 2016 at 8:21
  • Please update the question with the code you wrote in comment. Can't read here Commented Aug 15, 2016 at 8:23
  • Or maybe even add a plunker pls. Commented Aug 15, 2016 at 8:24

2 Answers 2

1
$timeout(function() {
  $scope.isEnabled = true;
  // ...
}, 3000);
Sign up to request clarification or add additional context in comments.

Comments

0

as mentioned by Mikko, your syntax seems to be wrong. it should be like

$scope.buttonWait = function() {
 $timeout(function() { 
   $scope.isEnabled = true, 
   $scope.showNotification = false, 
   $scope.completeNotification = true
  }), 3000);
};

sample plnkr link here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.