I'm looking for the best way to handle HostBinding with async value.
Before Angular v2.1.2 I could use the host
property in the @Directive
decorator like that :
@Directive({
selector: 'img[my-directive]',
host : {
'[alt]' : "alt |?async"
}
})
export class MyDirective {
alt: Observable<string>;
}
But it looks like this was not the intended behavior, since version 2.1.2 fixes it. See don't access view local variables nor pipes in host expressions.
Now, when compiling with AoT compilation, I get Parser Error: Host binding expression cannot contain pipes in Directive
.