angular-progress-button-styles icon indicating copy to clipboard operation
angular-progress-button-styles copied to clipboard

Add support for custom event instead of 'click'

Open danielgranat opened this issue 8 years ago • 0 comments

Hi there,

I recently needed to change the flow when a user clicks on the progress button, and before starting the progress the user needs to confirm the action he is about to make. To allow this i added another optional attribute for custom-event, in which case instead of binding to the click event, i bind to the custom event.

After the change, by button html looks like this:

<button custom-event="start-progress" ng-click="submitClick($event)" progress-button="submitPromise()">Submit</button>

My submit click function looks like this:

$scope.submitClick = function($event){
  confirmSubmitDialog.show(function() {
    $($event.currentTarget).trigger('start-progress');
  });
}

Another change i had to make to support this is when an event is triggered, to change the $scope.apply() to $timeout, because a digest may already be in progress.

What do you think?

danielgranat avatar Sep 01 '16 07:09 danielgranat