ng-bootstrap collapse: How to apply animations?

后端 未结 4 1086
猫巷女王i
猫巷女王i 2021-02-19 09:39

I\'m using Collapse: https://ng-bootstrap.github.io/#/components/collapse

However, it does not animate; even not on the demo site. How should I implement this??

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 10:09

    inside your component you can add something like this:

     animations: [
        trigger('expandCollapse', [
                    state('open', style({height: '100%', opacity: 1})),
                    state('closed', style({height: 0, opacity: 0})),
                    transition('* => *', [animate('100ms')])
                ]),
     ]
    
    
     
    ...

    See more details here https://angular.io/guide/animations#animating-a-simple-transition

提交回复
热议问题