简体   繁体   中英

Trying to understand NGx-Bootstrap datepicker component

I'm having some trouble understanding the docs for the date picker component.

Date Picker Documentation

What I understand:

  • [(bsValue)] should be set to the variable on the controller that I want to fill with a Date object
  • bsDatepicker is the directive that makes it a date picker

What I don't understand:

  • what #dp=bsDatepicker is for/does
  • (click)=dp.toggle() throws an error about the property toggle of undefined being called, but it does work!

I do understand that the spec for this isn't final, but what are these properties and what are they supposed to do?

#dp=bsDatepicker is to set a template variable dp to the directive bsDatepicker . It basically gives the db variable reference to bsDatePicker type so it has access to bsDatePicker methods and stuffs. Then on button (click) event, you assign dp.toggle() so that the button will toggle the DatePicker. I hope I am making sense.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM