EVOLUTION-MANAGER
Edit File: input[week].html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/input.js?message=docs(input[week])%3A%20describe%20your%20change...#L388' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ng/directive/input.js#L388' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">input[week]</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - input in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 week format (yyyy-W##), for example: <code>2013-W02</code>.</p> <p>The model must always be a Date object, otherwise Angular will throw an error. Invalid <code>Date</code> objects (dates whose <code>getTime()</code> is <code>NaN</code>) will be rendered as an empty string.</p> <p>The timezone to be used to read/write the <code>Date</code> instance in the model can be defined using <a href="api/ng/directive/ngModelOptions">ngModelOptions</a>. By default, this is the timezone of the browser.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2>Usage</h2> <pre><code><input type="week" ng-model="" [name=""] [min=""] [max=""] [required=""] [ng-required=""] [ng-change=""]></code></pre> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> ngModel </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Assignable angular expression to data-bind to.</p> </td> </tr> <tr> <td> name <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Property name of the form under which the control is published.</p> </td> </tr> <tr> <td> min <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets the <code>min</code> validation error key if the value entered is less than <code>min</code>. This must be a valid ISO week format (yyyy-W##).</p> </td> </tr> <tr> <td> max <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets the <code>max</code> validation error key if the value entered is greater than <code>max</code>. This must be a valid ISO week format (yyyy-W##).</p> </td> </tr> <tr> <td> required <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets <code>required</code> validation error key if the value is not entered.</p> </td> </tr> <tr> <td> ngRequired <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Adds <code>required</code> attribute and <code>required</code> validation constraint to the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of <code>required</code> when you want to data-bind to the <code>required</code> attribute.</p> </td> </tr> <tr> <td> ngChange <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Angular expression to be executed when input changes due to user interaction with the input element.</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-week-input-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-week-input-directive" name="week-input-directive" module="weekExample"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><script> angular.module('weekExample', []) .controller('DateController', ['$scope', function($scope) { $scope.value = new Date(2013, 0, 3); }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a date between in 2013: <input id="exampleInput" type="week" name="input" ng-model="value" placeholder="YYYY-W##" min="2012-W32" max="2013-W52" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.week"> Not a valid date!</span> <tt>value = {{value | date: "yyyy-Www"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>var value = element(by.binding('value | date: "yyyy-Www"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('2013-W01'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('2015-W01'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-week-input-directive/index.html" name="example-week-input-directive"></iframe> </div> </div> </p> </div>