Dialog with Date Picker

Size
2,700 Kb
Views
48,576

How do I make an dialog with date picker?

Test running a date picker in a modal dialog.. What is a dialog with date picker? How do you make a dialog with date picker? This script and codes were developed by Michael E Conroy on 03 July 2022, Sunday.

Dialog with Date Picker Previews

Dialog with Date Picker - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Dialog with Date Picker</title> <link rel='stylesheet prefetch' href='http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='http://cdn.rawgit.com/m-e-conroy/angular-dialog-service/v4.2.0/dialogs.min.css'>
</head>
<body> <div class="container" ng-app="modalTest" ng-controller="dialogTestCtrl"> <div class="row"> <div class="col-md-12"> <h1>Dialog Custom Service with Date Picker Demo</h1> <p>Testing whether another directive in a custom dialog works properly. In this demo we'll use the Date Picker directive that comes with Angular-UI-Bootstrap.</p> </div> </div> <div class="row"> <div class="col-md-12"> <button class="btn btn-primary" ng-click="launch()">Launch Custom Dialog</button> </div> </div> <div class="row"> <div class="col-md-12"> <br/> <p>Date Picked: <span class="text-info">{{data.dt | date:'fullDate' }}</span></p> </div> </div>
</div> <script src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js'></script>
<script src='http://code.angularjs.org/1.2.16/angular.min.js'></script>
<script src='http://code.angularjs.org/1.2.16/angular-sanitize.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/bower-angular-translate/2.0.1/angular-translate.min.js'></script>
<script src='http://rawgithub.com/m-e-conroy/angular-dialog-service/v4.2.0/example/js/ui-bootstrap-tpls-0.11.0.min.js'></script>
<script src='http://rawgithub.com/m-e-conroy/angular-dialog-service/v4.2.0/dialogs.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Dialog with Date Picker - Script Codes JS Codes

angular.module('modalTest',['ui.bootstrap','dialogs.main']) .controller('dialogTestCtrl',function($scope,dialogs){ //== Variables ==// $scope.data = { dt: new Date() }; //== Methods ==// $scope.launch = function(){ var dlg = dialogs.create('/dialogs/custom.html','customDialogCtrl',$scope.data); dlg.result.then(function(data){ $scope.data = data; }); }; // end launch }) // end dialogTest .controller('customDialogCtrl',function($log,$scope,$modalInstance,data){ $scope.data = data; $scope.opened = false; //== Listeners ==// $scope.$watch('data.dt',function(val,old){ $log.info('Date Changed: ' + val); $scope.opened = false; }); //== Methods ==// $scope.setDate = function(){ if(!angular.isDefined($scope.data.dt)) $scope.data.dt = new Date(); // today }; $scope.setDate(); $scope.open = function($event){ $event.preventDefault(); $event.stopPropagation(); $scope.opened = true; }; // end open $scope.done = function(){ $modalInstance.close($scope.data); }; // end done }) // end customDialogCtrl .config(function(dialogsProvider){ // this provider is only available in the 4.0.0+ versions of angular-dialog-service dialogsProvider.useBackdrop(true); dialogsProvider.useEscClose(true); dialogsProvider.useCopy(false); dialogsProvider.setSize('sm'); }) // end config .run(function($templateCache){ $templateCache.put('/dialogs/custom.html','<div class="modal-header"><h4 class="modal-title">Date Picker Test</h4></div><div class="modal-body"><p class="input-group"><input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="data.dt" datepicker-mode="year" is-open="opened" show-button-bar="false" /><span class="input-group-btn"><button class="btn btn-default" ng-click="open($event)"><span class="glyphicon glyphicon-calendar"></span></button></span></p></div><div class="modal-footer"><button class="btn btn-default" ng-click="done()">Done</button></div>'); }); // end run
Dialog with Date Picker - Script Codes
Dialog with Date Picker - Script Codes
Home Page Home
Developer Michael E Conroy
Username m-e-conroy
Uploaded July 03, 2022
Rating 4
Size 2,700 Kb
Views 48,576
Do you need developer help for Dialog with Date Picker?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Michael E Conroy (m-e-conroy) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!