Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom event instead of 'click' #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

danielgranat
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant