angularjs - 如何根据 ng-model 值设置输入类型 =“日期”的日期
问题描述
我在 $scope 中有一个日期。当页面加载时,我希望在 $scope 中的值上设置输入 type="date" 字段值。
<input class="form-control" type="date"
ng-model="asso.formation_of_association"
placeholder="" />
但我只dd-mm-yyy
在输入字段上看到
解决方案
您应该展示您的代码,因为我准备了一个示例并且它有效。
<div ng-app>
<div ng-controller="myCtrl">
<input type="date" ng-model="date.formation_of_association">
</div>
</div>
function myCtrl($scope) {
$scope.asso = {
'formation_of_association': '2018-06-21'
};
}
推荐阅读
- css - 我的“grunt watch”正在运行,但它没有应用从 SCSS 到 CSS 的更改
- curl - curl 请求和 globbing 括号
- android-ndk - 哪个(最新)llvm 版本是 Android NDK 的正确版本?
- python-3.x - 删除 Anaconda3 后,我仍然在 PowerShell 中收到这些错误
- github - 尝试从 github 导入代码到故障,但错误消息已显示
- r - 我可以在 Shiny plot_ly 中“配对”轨迹,以便在单击图例时出现/消失两条轨迹吗?
- python - 如何在 Django ORM 中使用条件预取或子查询深度嵌套的对象
- r - 按子字符串对向量进行排序
- python - python中的函数错误
- sockets - 为什么我不能激发 TCP 将 send() 拆分为多个 recv()