Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created October 20, 2016 15:02
Show Gist options
  • Save NetanelBasal/43694cdc7f7b7277c44cd37953335172 to your computer and use it in GitHub Desktop.
Save NetanelBasal/43694cdc7f7b7277c44cd37953335172 to your computer and use it in GitHub Desktop.
navigation.component.ts
import { select } from 'ng2-redux';
@Component({
template: '
<nav>
<ul>
<li *ngIf="!(isLoggedIn$ | async)">Sign in</li>
<li *ngIf="!(isLoggedIn$ | async)">Sign up</li>
<li *ngIf="(isLoggedIn$ | async)">Log out</li>
</ul>
</nav>
'
})
class NavComponent {
@select(["session", "isLoggedIn"]) isLoggedIn$: Observable<boolean>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment