Created
October 6, 2021 09:05
-
-
Save MasterHans/851565761730c912b78896f6c2977492 to your computer and use it in GitHub Desktop.
AngularJS - link in Custom Directive sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('b1').directive("extOnChanges", function ($translate) { | |
return { | |
restrict: 'A', | |
link: function (scope, elem, attrs) { | |
elem.on('click', function() { | |
alert('You clicked me!'); | |
// elem.html('You clicked me'); | |
}); | |
elem.on('mouseenter', function() { | |
elem.css('background-color', 'yellow'); | |
}); | |
elem.on('mouseleave', function() { | |
elem.css('background-color', 'white'); | |
}); | |
elem.on('keydown', function(event) { | |
if (event.keyCode === 13) { | |
alert('You entered me!'); | |
} | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment