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

ion-directives could broadcast gestures to controller #647

Closed
gregaton opened this issue Feb 20, 2014 · 2 comments
Closed

ion-directives could broadcast gestures to controller #647

gregaton opened this issue Feb 20, 2014 · 2 comments
Milestone

Comments

@gregaton
Copy link

Instead of only supporting touch/click events with a fixed behavior the directives could also support other gestures and broadcast them to the corresponding controller.

I said could because I'm not sure what potential drawbacks all those event listeners and broadcast messages could have.

To give a practical example, I am currently using the following directive to allow hold gestures for my tabs.

module.directive('ionTabControllerItem', ['$rootScope', '$ionicGesture', function($rootScope, $ionicGesture) {
  return {
    priority: -10,
    restrict: 'E',
    require: '^ionTabs',
    compile: function(element, attr, transclude) {
      return function link(scope, element, attrs, tabsCtrl) {
        $ionicGesture.on('hold', function(e) {
          $rootScope.$broadcast('tab.hold', scope.$index);
        }, element);
      };
    }
  };
}]);
@ajoslin
Copy link
Contributor

ajoslin commented Feb 25, 2014

Hi @gboxall,

Right now you are doing this the best way you can.

Starting in 0.9.26 and the nightly build, change ionTabControllerItem to ionTabNav in your case.

In the future, we may have declaratively created tabNav, so you could just do <ion-tab-nav ion-hold="action()">. Right now, your way is good.

@ajoslin ajoslin closed this as completed Feb 25, 2014
ajoslin added a commit that referenced this issue Feb 25, 2014
Closes #597. Fixes #634. Fixes #334. Fixes #175. Fixes #646. Closes #647.
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants