why angularjs link function is never called?

Viewed 58

Angularjs link function is never called.

The source code is included in webpack bundle.

angular version is v1.6.6

import angular from 'angular';

const module = angular.module('app.directives.ax', []);

console.log('included directive');
module.directive('ax', function() {
  return {
    restrict: 'AEC',
    link: function(scope, elem, attrs) {
      console.log('from directive');
      console.log('from directive xxx');
      elem.css('cursor', 'pointer');
      if (attrs.ngClick || attrs.href === '' || attrs.href === '#') {
        elem.on('click', function(e){
          e.preventDefault();
        });
      }
    }
 };
});

export default module.name;

In the html template I have

<a class="default-link ax" ng-click="vm.delete(announcement.id)"><i class="fa fa-trash-o"></i></a>
0 Answers
Related