title: Trying to emit an event to show main menu after login, but my variable never receives the event
body: <p><strong>EDIT:</strong></p>
  
  <p>This might be a more applicable Question to answer for me as it is more useful <a href="https://stackoverflow.com/questions/35397198/how-can-i-watch-for-changes-to-localstorage-in-angular2">How can I watch for changes to localStorage in Angular2?</a></p>
  
  <p>So I have my main app.component with navbar and  and a separate login page.  what I want is when they are logged in they can see the menu otherwise they can't.  What would be great is if I can add a change to localStorage event.  This way I can make one menu to dynamically change on localStorage event.</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Component({
      selector: 'my-app',
      providers: [FORM_PROVIDERS, RoleService, UserService, Login, LoginService],
      inputs: ['loggedIn'],
      directives: [ROUTER_DIRECTIVES, CORE_DIRECTIVES, LoggedInRouterOutlet],
      template: `&lt;body&gt;
                  &lt;div *ngIf="loggedIn === true"&gt;
                      &lt;nav class="navbar navbar-inverse navbar-top" role="navigation"&gt;
                          &lt;div class="container"&gt;
                                  &lt;div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"&gt;
                                      &lt;ul class="nav navbar-nav navbar-right"&gt;
                                      &lt;li&gt;
                                          &lt;a (click)="logout()"&gt;Logout&lt;/a&gt;
                                      &lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/div&gt;
                           &lt;/div&gt;
                      &lt;/nav&gt;
                  &lt;/div&gt;
                      &lt;div class="container"&gt;
                          &lt;router-outlet&gt;&lt;/router-outlet&gt;
                      &lt;/div&gt;
                    &lt;/body&gt;`
  })
  export class AppComponent{
  
      loggedIn: boolean;
  
      constructor(public Login: Login){ /*&lt;--This is a component, can I use it in constructor?*/
          Login.loggedIn.subscribe((data) =&gt; this.onUserChanged(data));
      }
  
      onUserChanged(user){
          this.loggedIn = true;
          console.log(this.loggedIn);
      }
  
      logout(){
          localStorage.removeItem('jwt');
      }
  
  }
  </code></pre>
  
  <p>My Login.component:</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Component
  export class Login{
  
      jwt: any;
      username: string;
      password: string;
      loggedIn: EventEmitter&lt;boolean&gt;;
  
      constructor(public _loginService: LoginService, public router: Router){
          this.loggedIn = new EventEmitter();
      }
  
      submitLogin(username, password){
          let body = {username, password};
          this._loginService.authenticate(body).subscribe(
              response =&gt; {
                  localStorage.setItem('jwt', response.json_token);
                  this.router.navigate(['UserList']);
                  this.loggedIn.emit(&lt;boolean&gt;true); /*&lt;---Is this in the wrong place?*/
                  console.log(this.loggedIn);
              }
          );
  
      }
  }
  </code></pre>
  
  <p>My Login.service:</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Injectable()
  export class LoginService {
  
      constructor(public http: Http) {
  
      }
  
      authenticate(form_body){
          return this.http.post('/login', JSON.stringify(form_body), {headers: headers})
                  .map((response =&gt; response.json()));
      }
  }
  </code></pre>
  
  <p>I am sure it is something wrong with my event emitter.  I tried to replicate what was already answered in this post <a href="https://stackoverflow.com/questions/34588008/angular2-watch-provider-property-in-multiple-components">Angular2 - &#39;watch&#39; provider property in multiple components</a> but I just cannot seem to figure out what I am doing wrong.</p>
  
  <p>I'd like something that says if localstorage is set show menu.  Thanks!</p>