For few days I was trying to debug why my directive doesn't work. No event has been fired when I press a button. Finally I found which line breaks everything!
Inside template html I have line datepicker-popup ng-model="{{model}}" min-date="{{minDate}}" is-open="{{isOpened}}"
if I remove it everything works well. But it is essential part in my custom directive and I want to keep it. I assume problem is that I am using directive inside custom directive?
Could you please help me to identify problem and find a correct solution?
Thanks for any help!
Directive:
(function(){
function directive(){
return {
scope :{
model:'=model',
minDate:'=minDate',
isOpened:'=isOpened'
},
restrict: 'E',
templateUrl: 'templates/datepicker/datepicker.html',
controller: 'Ctrl'
};
};
app.directive('myDirective', directive);
})();
controller:
(function(){
function Controller($scope) {
$scope.open = function() {
alert('HELLO');
};
app.controller('Ctrl', Controller);
})();
template html:
<fieldset>
<div class='input-group'>
<input type="text" class="form-control" datepicker-popup ng-model="{{model}}" min-date="{{minDate}}" is-open="{{isOpened}}" datepicker-options="dateOptions" ng-required="true" close-text="Close" />
<span ng-click="open()" class="btn btn-default input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</fieldset>