【问题标题】:How to get a year datepicker in AngularJS Material?如何在 AngularJS Material 中获取年份日期选择器?
【发布时间】:2017-04-24 09:52:44
【问题描述】:

是否有可用的md-year 选择器?如果是,请与我分享一些链接。如果不是,那么是否可以将 md-datepicker 变成年份选择器?

我尝试了一个普通的,提供模式、模型类型等,但没有有用的输出。

【问题讨论】:

    标签: angularjs angular-material


    【解决方案1】:

    In the docs on <md-datepicker>,通过使用md-current-view 属性可以选择年份选择器,将其设置为yearmonth

    <md-datepicker
        md-current-view="year"
        ng-model="myCustomYearDate"
        md-placeholder="Enter Date">
    </md-datepicker>
    

    【讨论】:

    • 我试过了,但我没有得到我所期望的......我只想要几年plnkr.co/edit/Eey5nlIiTYtiXSHZ6Luf?p=preview
    • @SaEChowdary 看起来md-current-view 仅出现在 1.1.0 及更高版本中。将您的 angularjs-material 更新到 1.1.0 及更高版本
    • 我正在使用 md 版本 1.1.3,而您的更新有几个月甚至几年...我只需要后备箱
    • 不幸的是,没有办法只显示年视图。 Similar Question
    猜你喜欢
    • 2021-10-29
    • 2013-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 2019-03-28
    • 2018-04-01
    • 1970-01-01
    相关资源
    最近更新 更多