加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – Angular UI Bootstrap DatePicker initDate问题

发布时间:2020-12-17 07:10:38 所属栏目:安全 来源:网络整理
导读:我试图在angular bootsrap的datepicker指令中设置init-date.我收到以下错误 Error: [$parse:syntax] Syntax Error: Token ‘Jun’ is an unexpected token at column 5 of the expression [Sun Jun 21 2015 17:00:00 GMT-0700 (PDT)] starting at [Jun 21 20
我试图在angular bootsrap的datepicker指令中设置init-date.我收到以下错误

Error: [$parse:syntax] Syntax Error: Token ‘Jun’ is an unexpected token at column 5 of the expression [Sun Jun 21 2015 17:00:00 GMT-0700 (PDT)] starting at [Jun 21 2015 17:00:00 GMT-0700 (PDT)].

以下是我正在使用的标记

<div ng-controller="DatepickerDemoCtrl">
<h4>Popup</h4>
<div class="row">
    <div class="col-md-6">
        <p class="input-group">
            <input type="text"
                   class="form-control"
                   init-date="dateOptions.initDate"
                   datepicker-popup="{{format}}"
                   ng-model="dt"
                   is-open="opened"
                   min-date="dateOptions.minDate"
                   max-date="'2016-06-22'"
                   datepicker-options="dateOptions"
                   date-disabled="disabled(date,mode)"
                   ng-required="true" close-text="Close" />
          <span class="input-group-btn">
            <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
          </span>
        </p>
    </div>
</div>

这是我有的javascript方面

angular.module('app',['ui.bootstrap']);
angular.module('app').controller('DatepickerDemoCtrl',function ($scope) {
    $scope.open = function($event) {
        $event.preventDefault();
        $event.stopPropagation();

        $scope.opened = true;
    };
    $scope.dateOptions = {
        formatYear: 'yy',startingDay: 1,minDate: new Date(2015,9,9),initDate: new Date('2015-06-22')
    };
    $scope.format = ['MM-dd-yyyy'];
});

不确定我在这里可能会缺少什么…有人可以帮忙吗?

解决方法

升级到最新版本0.13应解决问题…我使用的是版本0.12

希望这可以帮助…

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读