I have created a simple directive to load a template. Within the template is a binding to a function in the controller that I wanted fired on ng-click.
The directive:
angular
.module('myApp')
.directive('someDirective', someDirective);
function someDirective() {
var directive = {
templateUrl: 'app/components/some-directive/some-directive.html',
controller: 'MyCoolController',
controllerAs: 'vm',
restrict: 'A',
};
return directive;
}
The controller:
angular
.module('myApp')
.controller('MyCoolController', MyCoolController);
function MyCoolController() {
var vm = this;
function clickMe() {
alert('clicked!');
}
cm.clickMe = clickMe;
}
The template:
<div my-cool-directive>
<a href="#" ng-click="vm.clickMe()">Click me</a>
</div>
My issue is that the ng-click event is not firing when the a is clicked.