Angular Animation For Dynamically Changing Height

后端 未结 4 1189
日久生厌
日久生厌 2020-12-14 02:56

I\'ve successfully gotten a panel to animate expanding and closing when entering and leaving the DOM. The problem is I now have a busy indicator inside the panel prior to sh

4条回答
  •  眼角桃花
    2020-12-14 03:31

    Transitions and unfixed sizes (fit-content, max-content, etc..) do not communicate well.

    Here's a sample of hack for this case:

    animations: [
        trigger('openCloseAnimation', [
          state('open', style({ maxHeight: '100px', overflow: 'auto' })),
          state('closed', style({ maxHeight: '60px' })),
          transition('* => closed', animate('0.2s')),
          transition('* => open', animate('0.5s')),
        ]),
      ],
    

    With MaxHeight, your div/container dont will exceed more than 'max-content', but will behave with 'fit-content'.

提交回复
热议问题