2

次の例/デモを試していますが、Chrome コンソールでこのエラーが発生し続けます。

Error: Non-assignable model expression: undefined (directive: datepicker)

実行中に 404 が表示されません。

使用されるコードは以下に基づいています。

http://angular-ui.github.io/bootstrap/#/modal

また

http://plnkr.co/edit/?p=preview

私のモーダルテンプレートのコード:

<pre>Selected date is: <em>{{dt | date:'fullDate' }}</em></pre>
    <div class="well well-small pull-left" ng-model="dt">
        <datepicker min="minDate" show-weeks="showWeeks"></datepicker>
    </div>

モーダルコントローラーのコード:

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

    $scope.showWeeks = true;
    $scope.toggleWeeks = function () {
        $scope.showWeeks = !$scope.showWeeks;
    };

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

    $scope.dateOptions = {
        'year-format': "'yy'",
        'starting-day': 1
    };
4

1 に答える 1

3

解決策は、datepicker で ng-model を定義することです。

<div class="well well-small pull-left" >
        <datepicker min="minDate" show-weeks="showWeeks" ng-model="dt"></datepicker>
    </div>
于 2013-08-07T20:32:20.180 に答える