I have a DockLayout and two css classes. I change state.sideDrawer.isOpen but element's class does not change. When I console.log its class I see that first class it gets stays still. I tried setting its class in .ts file and it worked. But I need ngClass to work. What could be wrong?
I am using latest Angular CLI(7.2.1) and Nativescript(5.1.0).
Here is the Playground link : https://play.nativescript.org/?template=play-ng&id=oCeLRd
<DockLayout #sideDrawer stretchLastChild="false" [ngClass]="{'sideDrawerOpen': state.sideDrawer.isOpen == true, 'sideDrawerClosed': state.sideDrawer.isOpen == false}" style="background-color: #3c3f47;width: 600px;padding: 0 0 5px 15px;"></DockLayout>
CSS:
@keyframes sideDrawerOpen {
from { transform: translate(-500, 0);}
to { transform: translate(0, 0);}
}
@keyframes sideDrawerClosed {
from { transform: translate(0, 0);}
to { transform: translate(-100, 0);}
}
.sideDrawerOpen{
animation-name: sideDrawerOpen;
animation-duration: 2s;
animation-fill-mode: forwards;
}
.sideDrawerClosed{
animation-name: sideDrawerClosed;
animation-duration: 2s;
animation-fill-mode: forwards;
}