cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Untitled

A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              
<html ng-app="datepickerApp" ng-cloak>
<head>
    <meta charset="utf-8">
    <title>Date picker</title>
</head>

<body ng-controller="MainCtrl">
    <div layout-fill layout="row" layout-align="center center">
        <div layout="column">
            <am-date-picker ng-model="from"
                            am-input-label="From"
                            am-max-date="to"
                            am-min-year="2000"
                            am-today-button="Today">
            </am-date-picker>

            <am-date-picker ng-model="to"
                            am-input-label="To"
                            am-min-date="from">
            </am-date-picker>

            <form name="myForm">
                <am-date-picker ng-model="date"
                                ng-change="onChange(date)"
                                am-min-date="from"
                                am-max-date="to"
                                am-locale="ru"
                                am-cancel-button="Отмена"
                                am-back-button-text="Назад"
                                am-input-label="Выберите дату"
                                am-today-button="Сегодня"
                                am-allow-clear="false"
                                am-input-date-format="L"
                                am-popup-date-format="D MMMM"
                                am-show-input-icon="true"
                                name="dateField"
                                required>
                </am-date-picker>
                <div ng-messages="myForm.dateField.$error" class="validation-messages">
                    <div ng-message="required">The date is required</div>
                    <div ng-message="minDate">Date is too early!</div>
                    <div ng-message="maxDate">Date is too late!</div>
                    <div ng-message="valid">The entered value is not a date!</div>
                </div>
            </form>
        </div>
    </div>

</body>
</html>

            
          
!
            
              .validation-messages {
            font-size: 11px;
            color: darkred;
            margin: -36px 0px 0 36px;
        }
            
          
!
            
              angular
    .module('datepickerApp', [
        'ngMaterial',
        'ngMessages',
        'am.date-picker',
    ])
  .config(['amDatePickerConfigProvider', function(amDatePickerConfigProvider) {
        amDatePickerConfigProvider.setOptions({
            calendarIcon: 'https://raw.githubusercontent.com/unmade/am-date-picker/master/dist/images/icons/ic_today_24px.svg',
            clearIcon: 'https://raw.githubusercontent.com/unmade/am-date-picker/master/dist/images/icons/ic_close_24px.svg',
            nextIcon: 'https://raw.githubusercontent.com/unmade/am-date-picker/master/dist/images/icons/ic_chevron_right_18px.svg',
            prevIcon: 'https://raw.githubusercontent.com/unmade/am-date-picker/master/dist/images/icons/ic_chevron_left_18px.svg'
        })
    }])
    .controller('MainCtrl', ['$scope',
        function ($scope) {
            var today = new Date();
            $scope.to = new Date(today.setDate(today.getDate() + 1));
            $scope.from = new Date('2015-11-05');
            $scope.date = null;
            $scope.onChange = function(date) {
                console.log('date was changed to', date);
            };
        }
    ]);

            
          
!
999px
Loading ..................

Console