Skip to content

Instantly share code, notes, and snippets.

@joonseokhu
Last active October 12, 2022 09:24
Show Gist options
  • Save joonseokhu/11e2b28c43a63ebce0b089cf18e8ba60 to your computer and use it in GitHub Desktop.
Save joonseokhu/11e2b28c43a63ebce0b089cf18e8ba60 to your computer and use it in GitHub Desktop.

Apple 모듈이랑 Banana 모듈이 있다. Apple 모듈 안에 있는 AppleService 를 Banana 모듈 안에 있는 BananaService 에서 불러와서 쓰고싶어서 다음처럼 썼는데 에러가 난다. 왜 나는지 이유랑 해결방법은? (힌트: 고쳐야 하는거 세가지)

// apple/apple.module.ts
import { Module } from "module";

@Module({
  providers: [AppleService],
})
export class AppleModule {}
// apple/apple.service.ts
@Injectable()
export class AppleService {}
// banana/banana.module.ts
@Module()
export class BananaModule {}
// banana/banana.service.ts
@Injectable()
export class BananaService {
  constructor(private readonly appleService: AppleService) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment