Parameter in to Animation Angular2

后端 未结 4 493
无人共我
无人共我 2020-11-30 03:00

I\'m trying to make a simple animation like the simple jQuery below

animate({\'left\' : left_indent})

I\'m using the Angular2 Animations bu

4条回答
  •  生来不讨喜
    2020-11-30 03:36

    Now it's possible.

    animations: [
        trigger('flyInOut', [
    
            state('for', style({
                left: '{{left_indent}}', // use interpolation
            }), {params: {left_indent: 0}}), // default parameters values required
    
            transition('* => for', [
                animate(2000, keyframes([
                    style({ opacity: 1, transform: 'translateX(0)', offset: 0 }),
                    style({ opacity: 1, transform: 'translateX(-300px)', offset: 0.5 }),
                ]))
            ]),
        ])
    ]
    

    UPDATE (according to SplitterAlex answer):

    in template (for Angular < 4.4.6):

    for Angular >= 4.4.6 template should be

提交回复
热议问题