我的代碼太大而無法在這裏發佈,所以我只是發佈相關的部分。AngularJs彈出日期選擇器不會打開
我有一個相當大的應用程序,現在我想添加一個datapicker。我複製了the Angular UI bootstrap site的代碼。
在我的控制器我初始化
$scope.popup1 ={'opened': false}
$scope.dt = new Date();
,並宣佈
$scope.open1 = function()
{
$scope.popup1.opened=true;
}
,在我看來,我有
<input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dt"
is-open="popup1.opened" min-date="minDate" max-date="maxDate"
datepicker-options="dateOptions" date-disabled="disabled(date, mode)"
ng-required="true" close-text="Close"
alt-input-formats="altInputFormats" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open1()">
<i class="glyphicon glyphicon-calendar"></i></button>
</span>
當我點擊按鈕,調用函數與$scope.popup1.opened
設置爲true。
但是,日期選擇器不會彈出。
我錯過了一些明顯的東西嗎?我需要啓用日期選擇器嗎?
當你剛剛設置true,is-open = true是否加載打開? –
一個很好的問題!但是,唉,不,它不: - ( – Mawg
@Mawg ..你找到解決方案嗎? – sajalsuraj