我有一个输入字段,我想向用户显示当前日期:
<input id="uploadformData" ng-model="upload.date" type="date" value="<?php echo date('Y-m-d'); ?>" />
问题是它不显示当前日期,但该值与ng-model冲突。如果没有提到ng模型,它就可以正常工作。
以下是ng-model的参考资料
var module = angular.module("AuthApp", [])
module.controller("MyCntrl", function($scope) {
$scope.currentUser = Parse.User.current();
//To send uploaded documents to a user
$scope.userUpload = function(form) {
var Message = Parse.Object.extend("Upload");
var upload = new Message();
upload.set("Subject", form.subject);
upload.set("user", {
__type: "Pointer",
className: "_User",
objectId: document.getElementById("userObjectId").value
});
upload.set("documentURL", document.getElementById('result').innerHTML);
upload.set("Message", form.message);
upload.set("Sender", form.sender);
upload.set("Type", form.type);
upload.set("Date", form.date);
upload.save(null, {
success: function(upload) {
//success
var div = document.getElementById("messageSent");
div.textContent = "Upload successfully delivered to " + document.getElementById("fullNameId").value;
scroll(0,0);
location.reload();
},
error: function(upload, error) {
//failure
}
});
答案 0 :(得分:1)
@haxtbh在评论中有一些非常好的建议。
在您的示例中,您在同一输入上使用ng-model
和value
,这是多余的,因为ng-model
将覆盖该值。
看看this example,也许会让你更清楚。