2
votes
            import { Injectable, Inject } from '@angular/core';
            import { Subject } from "rxjs/Subject";
            import { CompleterData, CompleterItem } from 'ng2-completer';
            import { ProgramService } from '../program.service';
            import { asEnumerable } from 'linq-es5';
            import { CacheService } from '../../../core/services/cache.service';

            @Injectable()
            export class ProgramIntelligentSearch extends Subject<CompleterItem[]> implements CompleterData {
                constructor(private programService: ProgramService,
                    private cacheService: CacheService,
                    @Inject(Array) private lessonTypes: Array<any>,
                    @Inject(Array) private programTypes: Array<any>,
                    @Inject(Array) private languages: Array<any>
                    ) {
                    super();
                }
      --------------------------------------------------------------------------  
        import { Observable } from "rxjs/Observable";
        import { CompleterItem } from "../components/completer-item";
        export interface CompleterData extends Observable<CompleterItem[]> {
            search(term: string): void;
            cancel(): void;
            convertToItem?(data: any): CompleterItem;
        }
------------------------------------------------------------------
            Use ng build --prod --aot

ERROR in Can't resolve all parameters for ProgramIntelligentSearch in D:/Git/xxxxxxx/Application/Htm l5/src/app/shared/service/search/program-intelligent-search.ts: ([object Object], [object Object], ?, ?, ?)

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\Git\cosmos-main-html5\App lication\Html5\src' @ ./src/main.ts 4:0-74 @ multi ./src/main.ts

1
Hi, there are a lot of reason for this problem. Start by taking a look here github.com/angular/angular-cli/issues/4551 and then check your dependencies. - Karbos 538
@Inject(ProgramService) private programService: ProgramService, @Inject(CacheService) private cacheService: CacheService, Does this work for you ? - Parth Ghiya

1 Answers

0
votes

You will have to add @Inject so that its dependency can be resolved.

So for custom services inside your service Inject its dependency with @Inject

In your code replace your custom services with

@Inject(ProgramService) private programService: ProgramService, @Inject(CacheService) private cacheService: CacheService,

You can understand it deeply from this blog. https://blog.thoughtram.io/angular/2015/09/17/resolve-service-dependencies-in-angular-2.html