Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularUI引导日期选择器设置最小日期_Javascript_Angularjs_Angularjs Scope_Angular Ui Bootstrap - Fatal编程技术网

Javascript AngularUI引导日期选择器设置最小日期

Javascript AngularUI引导日期选择器设置最小日期,javascript,angularjs,angularjs-scope,angular-ui-bootstrap,Javascript,Angularjs,Angularjs Scope,Angular Ui Bootstrap,我正在运行最新的AngularUI引导程序,我有一个日期选择器,当点击按钮打开它时,它就会被启用 我已经尝试并搜索了如何禁用被点击日期的答案,我希望最短日期为2013年1月1日-这意味着2012年12月31日及更久的日期将不可选择 下面是我的代码 ANGULARJS $scope.today = function() { $scope.dt = new Date();

我正在运行最新的AngularUI引导程序,我有一个日期选择器,当点击按钮打开它时,它就会被启用

我已经尝试并搜索了如何禁用被点击日期的答案,我希望最短日期为2013年1月1日-这意味着2012年12月31日及更久的日期将不可选择

下面是我的代码

ANGULARJS

                    $scope.today = function() {
                        $scope.dt = new Date();
                    };
                    $scope.today();

                    $scope.clear = function () {
                        $scope.dt = null;
                    };
                    // Disable weekend selection
                    $scope.disabled = function(date, mode) {
                        //return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
                    };

                    $scope.toggleMin = function() {
                        $scope.minDate = $scope.minDate ? null : new Date();
                    };
                    //$scope.toggleMin();

                    $scope.open = function() {
                        $timeout(function() {
                            $scope.opened = true;
                            $scope.minEndDate = '2013-01-01';
                        });
                    };


                    $scope.dateOptions = {
                        formatYear: 'yy',
                        startingDay: 1
                    };
                    $scope.initDate = new Date('2016-15-20');
                    $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
                    $scope.format = $scope.formats[0];
HTML

<input type="text" class="form-control input--text" datepicker-popup="{{format}}" ng-model="newperson.dob" is-open="$parent.opened" min="minEndDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
                    <button type="button" class="datepicker-btn" ng-click="open()"><i class="fa fa-calendar"></i></button>

属性是
min-date
您刚才在那里的
min

<input type="text" class="form-control input--text" datepicker-popup="{{format}}" ng-model="newperson.dob" is-open="$parent.opened" min-date="minEndDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
                    <button type="button" class="datepicker-btn" ng-click="open()"><i class="fa fa-calendar"></i></button>

嘿,唐纳德,我正在整理我的旧答案,如果这对你有帮助,请将此标记为已回答。格雷西亚斯。