-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(position): implement directional positioning #3900
feat(position): implement directional positioning #3900
Conversation
- When positioning based off `position` or `offset`, allow specification of direction
It might make sense to move the conditional adding and subtracting of It also might make sense to just move all of the CSS logic right into the method as well. |
} | ||
} else { | ||
newPosition.top = offset === 'offset' ? 0 : position.top; | ||
newPosition.left = position.left; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite confused about this line and 92-94. What are these cases? Are they fallbacks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
92-94 is the default case if it is a string but invalid value.
96-98 is the default case if it has no value set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's the default case, perhaps it be handled via a isInvalid
flag (or isDefaultPosition
) or something, and a check below, since the code is identical, might make sense to put it together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - I am not happy with how I wrote this, there are too many if-else conditionals here.
Closing in favor of #4762. |
position
oroffset
, allow specification of directionI will work on tests for this, but I am opening this up for review so that this code can be cleaned up some (I'm not a fan of all of these if conditionals here).
This will assist with #3782 with a cleaner implementation. Implementing this part is as simple as changing
template/datepicker/popup.html
toAnd the relevant lines in the
datepickerPopup
directive toHere is a Plunker with those changes implemented.