Reputation: 2295
I'm trying to create a reusable directive which will do some operation on click
my directive code is
app.directive('share',['$cordovaSocialSharing',function($cordovaSocialSharing)
{
return {
restrict : 'A',
scope : {
},
link : function(scope,elm,attr)
{
elm.bind('click',function()
{
console.log('called share service');
});
}
};
}]);
only the first instance of the directive is getting executed on click the remaining instances are getting ignored
Upvotes: 0
Views: 226
Reputation: 452
Is correct the html? Is a attribute directive ( the restrict param is 'A'):
<button share>
Click me!
</button>
<button share>
Or click me!
</button>
http://jsfiddle.net/HB7LU/18220/
That should work!
Upvotes: 1