How to use date picker in Angular 2?

前端 未结 9 2097
耶瑟儿~
耶瑟儿~ 2020-12-08 20:03

I have tried many date picker in my angular2 app but none of them is working.Although the date picker is displaying on the view but the value of selected date is not getting

9条回答
  •  孤街浪徒
    2020-12-08 20:25

    See ng2-boostrap datePicker seems to overwrite ngModel, while the question is different, the answers given to it solved the issue you described for me.

    Assuming using typescript, you need to add this to the html markup:

    
    

    and in the component ts file, you will need to import

    import {DATEPICKER_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
    

    and add the DATEPICKER_DIRECTIVES to your providers list.

提交回复
热议问题