How to get a year datepicker in AngularJS Material

2019-09-15 01:00发布

问题:

Are there any md-year pickers available? if yes, please share me some links. If no, then is it possible to turn a md-datepicker into a year picker?

I have tried with a normal one with giving modes, types of models etc but no useful output.

回答1:

In the docs on <md-datepicker>, there is an option for a year picker by using the md-current-view attribute, setting it to either year or month:

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