var $directive = angular.module('myApp', []);
$directive.directive('myDirective', function(){
return {
restrict: 'E',
template: '<h4>{{title}}</h4>'
compile: function(element, attrs){
console.log('this is compile');
return function link(scope, element, attrs){
element.on('click', function(){
scope.title = 'My Directive 2 on click';
scope.dataPoint(scope.title);
});
};
},
controller: function($scope){
$scope.title = "My Directive";
$scope.dataPoint = function(title){
$scope.title = title;
};
}
};
});
<my-directive></my-directive>
I'm working on adjusting the value of the "title" variable in the controller when clicking on an element, however, I'm not seeing any updates after the click event. Can someone provide some guidance on this issue? Thank you!