I am trying to get a datepicker from UI Bootstrap to open when I click an icon. Here is my html:
<p class="input-group">
<input type="text" class="form-control" datepicker-popup ng-model="dt" is-open="opened"/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
And here is my js:
scope.open = function() {
scope.opened = true;
};
scope.opened = false;
When I click the button, I hit open(), opened is changed and nothing happens. The datepicker does not appear. The strange thing is, if I put the ng-click on the input:
<input type="text" class="form-control" datepicker-popup ng-model="dt" is-open="opened" ng-click="open()"/>
Then the datepicker works and opens like it should. I am missing something somewhere. Does anyone understand what the issue it?