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="WeekCtrl"> <h3>input[week] directive example in AngularJS</h3> Pick a date in 2016: <input type="week" name="input" ng-model="value" placeholder="YYYY-W##" min="2015-53" max="2016-W52" required /> <span ng-show="Form.input.$error.required">Required!</span> <span ng-show="Form.input.$error.week">Not a valid Week!</span> <p>Date = {{value | date: "yyyy-Www"}}</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('WeekCtrl', function($scope) { }); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.