Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind translateX() transform in Angular 2+

How can one bind the transform: translateX() style in Angular?

What I've tried:

<div [style.transform]="translateX({{x}})">

and

<div [style.transform.translateX.px]="x">
like image 771
ᅙᄉᅙ Avatar asked Apr 07 '17 11:04

ᅙᄉᅙ


1 Answers

This should work

<div [style.transform]="'translateX(' + x + 'px)'">

Edit

It seems that it is necessary to bypass XSS protection for this to work.

like image 138
QoP Avatar answered Oct 26 '22 16:10

QoP