How get datepicker in mvc using angularjs

Posted by Cpatil1000 under ASP.NET MVC on 1/22/2018 | Points: 10 | Views : 623 | Status : [Member] | Replies : 0
<html>
<head>
<title>Angular JS Forms</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<link href="~/Content/jquery.datepick.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.4.1.min.js"></script>
<script src="~/Scripts/jquery.datepick.js"></script>
<script>
var mainApp = angular.module("mainApp", []);

mainApp.controller("studentController", function ($scope) {
$scope.reset = function () {
$scope.firstName = 'Mahesh';
$scope.lastName = 'Parasher';
$scope.email = "MaheshParashar@tutorialspoint.com";;
}
$scope.reset;
});
</script>
<script type="text/javascript">

$(document).ready(function () {
$('#date').datepicker({
dateFormat: "dd/M/yy",
changeMonth: true,
changeYear: true,
yearRange: "-60:+0"
});

});
</script>

<style>
table, th, td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}

table tr:nth-child(odd) {
background-color: #f2f2f2;
}

table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
</head>
<body>
<h2>AngularJS Sample Application</h2>
<div ng-app="mainApp" ng-controller="studentController">
<form name="studentForm" novalidate>
<table border="0">
<tr>
<td>Enter First Name</td>
<td>
<input type="text" name="firstName" ng-model="firstName" required />
<span style="color:red" ng-show="studentForm.firstName.$dirty && studentForm.firstName.$invalid">
<span ng-show="studentForm.firstName.$error.required">First Name is required</span>
</span>
</td>
</tr>
<tr>
<td>Enter Last Name</td>
<td>
<input type="text" name="lastName" ng-model="lastName" required />
<span ng-show="studentForm.lastName.$dirty && studentForm.lastName.$invalid">
<span style="color:red;" ng-show="studentForm.lastName.$error.required">Last Name is required</span>
</span>
</td>
</tr>
<tr>
<td>Date :</td>
<td>
<input type="text" id="date" name="date" ng-model="date" required />
<span ng-show="studentForm.date.$dirty && studentForm.date.$invalid">
<span style="color:red;" ng-show="studentForm.date.$error.required">Date is required</span>
</span>
</td>
</tr>
<tr>
<td>
<button ng-click="reset()">Reset<




Responses

(No response found.)

Login to post response