title: Using the Angular 2 Http client in order to rehydrate application state in a ngrx meta reducer
body: <p>I need to be able to use the Angular 2 <code>Http</code> client right from the <code>@NgModule's imports</code>. This is required in order to rehydrate application state by fetching data from the backend using the <code>Http</code> client.</p>
  
  <p>Here is how my sample application is configured:</p>
  
  <pre><code>@NgModule({
    imports: [
      CommonModule,
      BrowserModule,
      HttpModule,
      ComponentsModule,
      RouterModule.forRoot(routes, { useHash: true }),
      StoreModule.provideStore(reducer),//See below for definition of reducer
      ...
  </code></pre>
  
  <p>Here is the definition for the <code>reducer</code> function used above:</p>
  
  <pre><code>const initialState: State = {
    ids: [],
    loading: false,
    query: ''
  };
  
  export function reducer(state = initialState, action: book.Actions): State {
    switch (action.type) {
      case book.ActionTypes.SEARCH: {
        const query = action.payload;
        ...
  </code></pre>
  
  <p>I therefore need to somehow use the <code>Http</code> client to populate the <code>initialState</code> constant above. Is this possible? If so how?</p>
  
  <p>The trouble is that I need to somehow inject the <code>Http</code> client as the app is being bootstrapped...</p>
  
  <p>This is a requirement as it seems the library I use i.e. ngrx (<a href="https://github.com/ngrx" rel="nofollow noreferrer">https://github.com/ngrx</a>) depends on reducers defined at the time of application bootstrap.</p>
  
  <p>I would be extremely grateful for help on this one...</p>