Lets take a look to my directive:
angular.module(\'main\').directive(\'datepicker\', [
function() {
return {
require: \'?ngModel\',
link:
Here's the best explanation I've encountered. This helped me big time, and brings together details from a number of the other answers here.
TIP: Be careful to read the whole article rather than skim it, or else you are likely to miss some key bits!
https://www.nadeau.tv/post/using-ngmodelcontroller-with-custom-directives/