Javascript 如何使用angularjs从数据库中仅在datepicker中显示日期 app.controller('getUser',函数($scope,$http,$cookieStore){ $http.get('http://localhost:8080/myapp/user/“.concat($scope.getUserId)+”?访问令牌=”+$cookieStore.get(“访问令牌”))。 然后(功能(响应){ $scope.users=response.data; });}); 表名:用户{id | userDate | 1 | 2016-11-28 05:30:00.0} 日期
提及 您需要以正确的可接受格式(Javascript 如何使用angularjs从数据库中仅在datepicker中显示日期 app.controller('getUser',函数($scope,$http,$cookieStore){ $http.get('http://localhost:8080/myapp/user/“.concat($scope.getUserId)+”?访问令牌=”+$cookieStore.get(“访问令牌”))。 然后(功能(响应){ $scope.users=response.data; });}); 表名:用户{id | userDate | 1 | 2016-11-28 05:30:00.0} 日期,javascript,angularjs,angularjs-directive,datepicker,Javascript,Angularjs,Angularjs Directive,Datepicker,提及 您需要以正确的可接受格式(YYYY-MM-DD)向提供值,以便在HTML5日期输入中正确显示 在html模板中呈现日期之前,您应该能够使用过滤器格式化日期(在yyyy-MM-dd格式中),或者在控制器本身中进行格式化 app.controller('getUser', function ($scope, $http, $cookieStore) { $http.get('http://localhost:8080/myapp/user/'.concat($scope.getUserId)
YYYY-MM-DD
)向
提供值,以便在HTML5日期输入中正确显示
在html模板中呈现日期之前,您应该能够使用过滤器格式化日期(在yyyy-MM-dd
格式中),或者在控制器本身中进行格式化
app.controller('getUser', function ($scope, $http, $cookieStore) {
$http.get('http://localhost:8080/myapp/user/'.concat($scope.getUserId) + '?access_token=' + $cookieStore.get("access_token")).
then(function (response) {
$scope.users = response.data;
});});
Table name: user{ id | userDate | 1 | 2016-11-28 05:30:00.0}
<div ng-controller="getUser">
<label class="control-label">Date</label>
<input type="date" class="form-control" ng-model="users.userDate" ng-value="{{users.userDate"}}">
</div>
请参阅
您需要以正确的可接受格式(YYYY-MM-DD
)向
提供值,以便在HTML5日期输入中正确显示
在html模板中呈现日期之前,您应该能够使用过滤器格式化日期(在yyyy-MM-dd
格式中),或者在控制器本身中进行格式化
app.controller('getUser', function ($scope, $http, $cookieStore) {
$http.get('http://localhost:8080/myapp/user/'.concat($scope.getUserId) + '?access_token=' + $cookieStore.get("access_token")).
then(function (response) {
$scope.users = response.data;
});});
Table name: user{ id | userDate | 1 | 2016-11-28 05:30:00.0}
<div ng-controller="getUser">
<label class="control-label">Date</label>
<input type="date" class="form-control" ng-model="users.userDate" ng-value="{{users.userDate"}}">
</div>
试试这个
需要零钱
<input type="date" class="form-control" ng-model="users.userDate" ng-value="{{users.userDate | date: 'yyyy-MM-dd'}}">
试试这个
需要零钱
<input type="date" class="form-control" ng-model="users.userDate" ng-value="{{users.userDate | date: 'yyyy-MM-dd'}}">
您必须将其添加到html中
$scope.userdate= new Date(users.userDate);
如果您不想添加上述脚本,则可以将输入标记type=“text”
设置为正常,但不会弹出日期选择器。您必须将其添加到html中
$scope.userdate= new Date(users.userDate);
如果您不想添加上述脚本,则可以使用输入标记type=“text”
,该标记可以正常工作,但不会弹出日期选择器。我假设用户实际上包含一个用户。所以当您已经有了一个ng model=“users.userDate”
时,您对ng value=“{{{users.userDate”}}}}”需要什么?您似乎有一个额外的”
ng value=“{{users.userDate”}}”
我假设用户实际上包含一个用户。那么,ng value=“{{users.userDate}”需要什么
当您已经有一个ng model=“users.userDate”
时,您似乎有一个额外的“
ng value=“{{users.userDate”}}”
您还有一个完全不需要的额外属性ng value=“{{users.userDate}”
您还有一个完全不需要的额外属性ng value=”{{users.userDate}“