I have an input field, where I would like to display to the user the current date:
<input id="uploadformData" ng-model="upload.date" type="date" value="<?php echo date('Y-m-d'); ?>" />
problem is that it doesn't display the current date but the value conflicts with the ng-model. Without the ng-model being mentioned it works fine.
Below is where the ng-model is reference
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
}
});
@haxtbh has some very good suggestions in the comments.
In your example your are using ng-model
and value
on the same input, which is redundant because ng-model
will overwrite the value.
Take a look at this example, maybe it will make it clearer for you.