title: Angular 7 - build --prod failed with error: Can't resolve all parameters for
body: <p>I use Angular: 7.2.10 and when I try to build project for production with command:</p>
  
  <pre><code>ng b --prod
  </code></pre>
  
  <p>I got error</p>
  
  <pre><code>ERROR in : Can't resolve all parameters for ApiService in ...
  </code></pre>
  
  <p>I have service with a constructor with 3 params:</p>
  
  <pre><code>constructor(api: string, private _http: HttpClient, private httpUtils: HttpUtilsService) {
      this.api = `${api}/api`;        
    }
  </code></pre>
  
  <p>Which instantiates by factory defined at app.module.ts:</p>
  
  <pre><code>{      
        provide: ApiService,
        useFactory: apiHost,
        deps: [Store, HttpClient, HttpUtilsService]
      }
  </code></pre>
  
  <p>apiHost</p>
  
  <pre><code>export function apiHost(store: Store&lt;RemoteConfig&gt;, http: HttpClient, httpUtils: HttpUtilsService) {
    let item: string = localStorage.getItem(environment.apiHost);
  
    //store.pipe(select(backendApiHost), take(1)).subscribe(api =&gt; item = api); // Todo not always read val!
    //console.log('ss: ' + item);
    return new ApiService(item, http, httpUtils);
  }
  </code></pre>
  
  <p>When I use <code>ng build</code> it works successfully.</p>