Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body> <form ng-app="myApp" name="Form" ng-controller="datetimeCtrl"> <h3>input[datetime-local] directive example in AngularJS</h3> Select a date between in 2016: <input type="datetime-local" name="input" ng-model="value" placeholder="yyyy-MM-ddTHH:mm:ss" min="2010-01-01T00:00:00" max="2016-12-31T00:00:00" required /> <span ng-show="Form.input.$error.required">Required!</span> <span ng-show="Form.input.$error.datetimelocal">Not a valid date!</span> <p>value = {{value | date: "yyyy-MM-ddTHH:mm:ss"}}</p> <p>Form.input.$valid = {{Form.input.$valid}}</p> <p>Form.input.$error = {{Form.input.$error}}</p> <p>Form.$valid = {{Form.$valid}}</p> <p>Form.$error.required = {{!!Form.$error.required}}</p> </form> <script> var app=angular.module('myApp', []); app.controller('datetimeCtrl', function($scope) { }); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.