Angular 2 get data before loading child components
<p>I want to get the user data in the main root component of the app and then after user data is stored into service to continue loading other components. How can I achieve this? Currently, I have something like this:</p>

<pre><code>@Injectable()
export class UserService {

user: Subject&lt;User&gt; = new BehaviorSubject(new User());

constructor(private _httpService: HTTPService){}

getUser(){
    return this.user;
}

getUserFromAPI(){
    this._httpService.get('user')
        .map(data =&gt; data.json())
        .subscribe(data =&gt; {
            this.user.next(data);
        });
}
</code></pre>

<p>But with this way, it means that I need to get the user on every other place through the Observable which I don't want. I want to have a static access.
Currently, I'm getting the user:</p>

<pre><code>this._userService.getUser().subscribe(data =&gt; {
        this.user = data;
    });
</code></pre>