My component has an Observable
named state$
: how can I avoid repeat myself when I need to access state$.favorites
, like the example below?
@Component({
selector: 'app-example',
template: `
<ng-container *ngIf="(state$ | async).favorites.length">
{{ (state$ | async).favorites.length }}
</ng-container>
`,
})
export class ExampleComponent() {
@Select(state => state.app) state$: Observable<AppState>;
}
Is there any way to assign it to a template variable?