title: Using subjects in Angular 2
body: <p>My <strong>main.service.ts</strong></p>
  
  <pre><code>@Injectable()
  export class AppService{
    private mainSource = new Subject&lt;boolean&gt;();
    main$ = this.mainSource.asObservable();
  }
  </code></pre>
  
  <p>My <strong>app.component.ts</strong></p>
  
  <pre><code>constructor(private appService: AppService){
    this.appService.main$.subscribe(
    working =&gt; {this.appService.main$(false);}
  }
  
  ngOnInit(){
      if (this.appService.main$){alert("Tio");}
  }
  </code></pre>
  
  <p>My app.component returns a <code>Cannot invoke an expression whose type lacks a call signature</code> error. And my OnInit alert fires regardless of whether or not the conditions have actually been met. In this case they have not. </p>
  
  <p>Subscriptions are still quite foreign to me, so I'm not clear on exactly what I should be doing here. I want to set my <code>main$</code> to an initial value of false. And when my page is loaded, I would like it to alert only if it is true. </p>