I am not able to open jQuery UI Date Picker in UI Bootstrap Model. Normal HTML date picker is opening up but jQuery Date Picker is not opening up. Here is the code:-
Test.html
<!DOCTYPE html>
<html ng-app="appHome">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link href="https://code.jquery.com/ui/1.10.4/themes/redmond/jquery-ui.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.5.0.js"></script>
<script src="../Scripts/AngularControllers/Test.js"></script>
<script src="../Scripts/AngularControllers/Test1.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="ModalDemoCtrl">
<button type="button" ng-click="open()">Open me!</button>
</div>
</body>
</html>
Test.js
var myApp = angular.module('appHome', ['ui.bootstrap']);
myApp.controller('ModalDemoCtrl', ['$scope', '$uibModal', function ($scope, $uibModal) {
$scope.open = function (size, parentSelector) {
var modalInstance = $uibModal.open({
templateUrl: 'Test1.html',
controller: 'ModalDemoCtrl1',
size :'lg'
});
};
}])
Test1.html
<div>
<h1>Modal Body</h1>
<input type="date" />
Date of Birth<input type="text" class="datepicker-ui" id="dateDOB" ng-model="dob">
</div>
Test1. js
var myApp = angular.module('appHome');
myApp.controller('ModalDemoCtrl1', ['$scope', function ($scope) {
$(".datepicker-ui").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
yearRange: "-100:+0",
stepMonths: 1,
onSelect: function (date) {
if (this.id == "dateDOB") {
$scope.dob = date;
$scope.$apply();
}
}
});
}])
Please find below the screenshot of HTML Pages after rendered in browser:-
After clicking on "Open Me" button
Here you can see the normal HTML Date control is working but jQuery UI Datepicker is not.
Please help me in making jQuery UI datepicker work in Modal.