2

I have used this Bootstrap datepicker with angular directive. It works fine. Now I need to one more little customization. When clicking first input, it will show first dropdown calender. Clicking another opens another calender dropdown. All I need now those dropdown won't show together. I mean when first dropdown is open, clicking on second input will open second dropdown as well as first dropdown should close. Similarly, when second dropdown is open, clicking on first input will open first calender dropdown and second dropdown should be close.

So, I need to do something like similar:

when date1 is open
close date2 if it is open
when date2 is open
close date1 if it is open

But, as I am new in angular, I don't understand how to do that in angular way. How to do that?

Plunker work

1 Answer 1

3

If you have only 2 datepicker then you can do it like this in place of

 $scope.open[date] = true;

put this

if(date=== 'date4'){
        $scope.open['date4'] = true;
        $scope.open['date5'] = false;
      }else{
        $scope.open['date4'] = false;
        $scope.open['date5'] = true;
      }

And if you have multiple datepicker then you can call loop to close them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.