Reputation: 77034
I want to have a calendar icon next to my input and when I click on that icon it should open the datepicker.
How to do?
Upvotes: 4
Views: 3064
Reputation: 77034
Still thinking in jQuery terms, eh?
Well, you can't "delegate" a click in angular, but you can use angular-ui-bootsrap
's is-open
attribute to specify a model to bind to, such as $scope.calendarOpened
.
<input ui-date type='text' ng-model="question.answer" is-open="calendarOpened" ui-date-format="dd/mm/yyyy">
<button type="button" ng-click="calendarOpened = !!calendarOpened" class="btn"><i class="icon-calendar"></i></button>
Tada!
Upvotes: 4