我的項目需要的日期時間,所以我發現(子午線格式)bootstrap-datetimepicker這似乎還不錯,但我不能夠使用它使用與AngularJS引導,日期時間選擇器
所有我在我的代碼確實是
<div class="control-group">
<label class="control-label">Date</label>
<div class="controls">
<div class="control-group input-append date form_datetime" data-date="2012-12-21T15:25:00Z">
<input size="16" type="text" ng-model="transaction.date" data-date-format="yyyy-mm-dd hh:ii" value="">
<span class="add-on"><em class="icon-remove"></em></span>
<span class="add-on"><em class="icon-th"></em></span>
</div>
</div>
</div>
,但是當我在我的控制器做的console.log($ scope.transaction)
$scope.save = function() {
var transaction = new Transaction();
transaction.name = $scope.transaction['name'];
transaction.debit = $scope.transaction['debit'];
transaction.date = $scope.transaction['date'];
transaction.amount = $scope.transaction['amount'];
transaction.category = $scope.transaction['category'].uuid;
console.log('adding', $scope.transaction);
}
我看到
Resource {name: "Test", debit: "False", date: undefined, amount: "12", category: "7816635c-3da1-4ccc-b8ab-c07bc3b42202"…}
日期未定義。如何將UI中選擇的值與ng-model相關聯?
UPDATE
雖然使用jQuery,我可以看到價值
$('.form_datetime input').val()
"08 May 2013 - 08:12 AM"
感謝
還有另一個可以在https:// github上找到的用於角度的datetimepicker指令。com/zhaber/datetimepicker – 2013-11-02 23:19:48