Without observables I can write the following line in the HTML template:
What about using combineLatest
?
For example:
import { combineLatest } from 'rxjs/observable/combineLatest';
import { Observable } from 'rxjs/Observable';
@Component({...})
export class FooComponent {
obs1$: Observable;
obs2$: Observable;
obs3$: Observable;
constructor(){
// set observables
}
get combined$(){
return combineLatest(
this.obs1$,
this.obs2$
this.obs3$,
(one,two,three)=>(one || two) && three);
}
}
// template
Check the following fiddle for guidance:
https://jsfiddle.net/uehasmb6/11/
More info about the combineLatest
operator here
UPDATE: But if you still want to keep all that logic inside of the template, you could try something like:
But I would advice you against this. Keeping the HTML template as clean as possible is a good practice.