Hello all there is any way to extend the inbuilt directive?
This is what I want to do.
For example my directive template is :
<div ng-click="condition && handleClick()" ng-transclude></div>
here condition is whether to perform the click to the div or not so when I reused the directive and make it nested I end-up like this.
note : the condition in my directive will not change dynamically this is just one time value.
<div ng-click="condition && handleClick()">
<div ng-click="condition && handleClick()">
<div ng-click="condition && handleClick()"></div>
</div>
</div>
So now the problem is if ng-click is added to the div angular binds the touchstart or click and others to the div, I want to avoid this bindings, due to this bindings many unnecessary events are added to the div which is not needed.
Now I want to extend the ng-click directive and need to add the condition check before binding the events with the element, if the condition is false I will not bind the event else if it true I will bind the event.
For fixing this I can write my own directive ng-click-condition and perform same operation as ng-click but with condition check but if I do this I will be lead to code duplication and maintainability issue, so I am finding some way to reuse the in-built directive.