Hide elements based on routing in Angular2 rc1
<p>I have some elements I want on every page except the login page. I'd like to use ngIf or possibly the hidden property of the elements to hide those elements when the user is on the login page.</p>

<p>I have tried this:</p>

<pre><code>&lt;div [hidden]="router.isRouteActive(router.generate('/login'))"&gt;
</code></pre>

<p>based on this question and answer: <a href="https://stackoverflow.com/questions/34323480/in-angular-2-how-do-you-determine-the-active-route">In Angular 2 how do you determine the active route?</a></p>

<p>And have also tried this:</p>

<pre><code> &lt;div *ngIf="!router.isRouteActive(router.generate('/login'))"&gt;
</code></pre>

<p>but haven't had any success.  </p>

<p>For reference here is the component that matches this html.</p>

<pre><code>import { Component, OnInit } from 'node_modules/@angular/core';
import { HTTP_PROVIDERS, XHRBackend } from 'node_modules/@angular/http';
import { Routes, Router, ROUTER_DIRECTIVES } from 'node_modules/@angular/router';

import { LoginService } from './login/login.service';
import { LoginComponent } from './login/login.component';
import { UserComponent } from './user/user.component';

@Component({
    selector: 'portal',
    templateUrl: 'portal/portal.component.html',
    directives: [ROUTER_DIRECTIVES, LoginComponent, UserComponent ],
    providers: [
        HTTP_PROVIDERS,
        LoginService
    ]
})

@Routes([
    { path: '/login', component: LoginComponent},
    { path: '/user/:username', component: UserComponent}
])

export class PortalComponent implements OnInit{
    private router: Router
    constructor() {}

    ngOnInit() {
        this.router.navigate(['/login']); 
    } 
}
</code></pre>

<p>The documentation for isRouteActive is pretty slim, the same for generate. Any direction on a better way to achieve this behavior?</p>