Cami Rodriguez Cami Rodriguez - 5 months ago 45
AngularJS Question

How to catch event onclick without ng-click Angular.js

I'm developing an Angular App but I want to catch onclick event without ng-click, I want to use something like that



AngularJs use directive to operate dom. you can add a directive like this.


YourApp.directive('testClick', function () {
    return {
        restrict: 'A',
        link: function (scope, element) {
            element.onclick = function() {
                //do some thing.


<button test-click>Test Click</button>