Angularjs Use custom attribute to customize your html behaviour
Sometimes you would like to add custom behaviour to our html markup and have a custom function invoke by it.
For example, lets say you're trying to implement google analytics to track specific field that a user interacts with. So we can create a custom directive that push tracking info to google analytics as user interacts with different field.
We can easily do that with angularjs directive as demostrated with code below :-
We create a normal directive and under the link section (Line #18), we use "on" method to listen to specific html event.
For a demo, please click here.