kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

Make toggleCalendar method return true on opening #23

Closed xuhcc closed 4 years ago

xuhcc commented 4 years ago

So we can use it like that:

const opened = datepicker.toggleCalendar()
if (opened) {
    ...
}
codecov-io commented 4 years ago

Codecov Report

Merging #23 into master will increase coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #23      +/-   ##
=========================================
+ Coverage   93.18%   93.2%   +0.01%     
=========================================
  Files          20      20              
  Lines        1116    1118       +2     
  Branches      235     235              
=========================================
+ Hits         1040    1042       +2     
  Misses         76      76
Impacted Files Coverage Δ
...mydatepicker/src/lib/angular-mydatepicker.input.ts 89.82% <100%> (+0.07%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4dd2c1b...22c053c. Read the comment docs.

kekeh commented 4 years ago

You can use calendarToggle callback: https://github.com/kekeh/angular-mydatepicker#calendartoggle-callback

Example: https://github.com/kekeh/angular-mydatepicker/wiki/calendarToggle-callback

xuhcc commented 4 years ago

I know, but I would prefer to use returned value as it better suits my needs.

kekeh commented 4 years ago

Ok. I merged this PR. Install latest version from npm.

The return value only indicates was the operation open or close. The close operation is always asychronous if calendar animations are used so in that case the toggleCalendar() may return before the calendar has closed.

xuhcc commented 4 years ago

Thanks!