i added an animation to the host via
@Component({
....,
animations: [
trigger('slideIn', [
...
])
],
host: {
'[@animation]': 'condition'
}
}
which worked well, on compilation i was told this is deprecated and i should use @HostBinding ...
@HostBinding('[@animation]') get slideIn() {
return condition;
}
which throws me an error
Can't bind to '[@animation' since it isn't a known property of 'my-component-selector'.
but i cannot add an animation into my module.. what can i do ?
The square brackets are not necessary with @HostBinding()
@HostBinding('@slideIn') get slideIn() {
There are two decorators @HostBinding()
and @HostListener()
therefore the distinction between ()
and []
isn't necessary, while it is when host: [...]
is used.