I am using Razor syntax and to bind date type input I used data_ng_model = 'date'
as it works in html razor. By Default in input field it displays dd/mm/yyyy
. I am changing value date
from angularJS script but it doesn't affect the display. Then I used Jquery to change the value attribute of that input field, it changes the value as I observed using inspect element but the display is still dd/mm/yyyy
. For example if using jquery I change the value to 10/09/2016
, it always displays dd/mm/yyyy
.
My code is like:
date = "10/09/2016";
$scope.date = (date.getDate() < 10 ? '0' : '') + date.getDate() + "/" + ((date.getMonth() + 1) < 10 ? '0' : '') + (date.getMonth() + 1) + "/" + date.getFullYear();
$("#eventDate").attr("value",$scope.date);
I think it should change the display of input field using $scope.date
as i am binding it like
@Html.TextBoxFor(model => model.Date, new {
@class = "form-control",
@type = "date", @id="eventDate",
data_ng_model = "date",
ng_change = "checkMe()"
})