angularjsプロジェクトでhttps://github.com/uxsolutions/bootstrap-datepickerのタイムピッカーを使用しています。選択した日付で更新されることはありません、私のメインコントローラでdatepickerを更新する命令がモデルを更新しない
app.directive("uxdatepicker", function()
{
return {
require: "ngModel",
scope: {
ngModel: '='
},
link: function (scope, element, attrs, controller)
{
element.datepicker({
language: "no",
format: "yyyy-mm-dd",
datesDisabled : ["2017-10-10"],
maxViewMode: "days"
}).on("changeDate", function (e)
{
scope.$apply(function()
{
controller.$setViewValue(e.date);
});
});
}
};
});
しかし$ scope.selectedDate:
<div uxdatepicker ng-model="selectedDate"
data-provide="datepicker-inline" ng-change="on_date_changed()">
</div>
私のようなディレクティブを作成しました:
HTMLは次のようになります。
どうしてですか?
変更日ハンドラにe.dateに選択した日付が保持されていることを通知しました。
エラーが別の場所だったので、私は、この質問を削除したいです。私はng-repeatの中にuxdatepickerを持っていましたが、そこに$ scope.selectedDateを変更できないようです。代わりに、e.selectedDateを使用しました。ここで、eはng-repeat項目です。 –