I need a transition between 2 colors OnClick
. Right now, this is my code:
Typescript
animations: [
trigger('menubarState', [
state('false', style({backgroundColor:'#43a047'})),
state('true', style({backgroundColor:'#333'})),
transition('false => true', animate('1s')),
transition('true => false', animate('1s'))
])
]
...
export class MenubarComponent {
menuActive: boolean = false;
onMenuClick () {
if (this.menuActive == false) {
this.menuActive = true;
} else {
this.menuActive = false;
}
}
}
HTML
<li [@menubarState]="menuActive" (click)="onMenuClick()">
<a><span class="material-icons icon">apps</span></a>
</li>
This does change the background-color
as it should. The change, however, is instant instead of a transition.
I am using the Chrome, latest version.