Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

[SOLVED] Ionic all buttons/a's onTap event

$
0
0

Hey there, I want to run a function everytime <button> or <a> is tapped

I know $ionicGestures:
http://ionicframework.com/docs/api/service/$ionicGesture/#on
But it doesn't help in this case, because I don't want to use directives, I want it to be for every button or a element.

How should I do it?

It's should be alternative for the jQuery case:

$("button, a").click(function() {
runFunction();
});

By the way:
I can use directive like <button run-function>Click here</button> but it has 2 disadvantage:
1. I need always to add this directive.
2. Can't use it in $ionicPopup (and more...)

Found great solution:

http://plnkr.co/edit/Tq0abplQlOuOug95H0VB?p=catalogue
It's for all <a>, <input>, <button> tags, and if there is a tag i want to set it specifically - i just use ionic-feedback, or $ionicFeedback factory.

It was built for device-feedback plugin. it's great i swear. use it.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>