I am using datepicker in the tabset elements from angular bootstrap. When I am using datepicker inside the tab and on selecting the date I am not able to get correct value of selected date in controller.
If i am removing the tab then I am able to get the currently selected date. The code is in plunker: http://plnkr.co/edit/dIJRDQUYdrKmChdIt9T2?p=preview
<form name="form" class="form-horizontal" ng-controller="ctrl">
<tabset>
<tab justified="true">
<tab-heading>
Main
</tab-heading>
<div class="form-group">
<label class="col-xs-2 control-label" for="etaDate">ETA Date</label>
<div class="input-group col-xs-6 col-sm-4 col-md-2">
<input class="form-control" id="etaDate" name="etaDate" type="text" ng-model="eta" datepicker-popup="dd/MM/yyyy" is-open="opened.open" show-weeks="false" />
<span class="input-group-btn">
<button class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</div>
</div>
<button ng-click="getdate()">GET DATE</button>
</tab>
</tabset>
</form>
script.js
angular.module('myApp', ['ui.bootstrap']);
var ctrl = function($scope) {
$scope.opened = {};
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened.open = true;
};
$scope.eta = new Date();
$scope.getdate = function (){
alert($scope.eta)
};
};