【发布时间】:2019-12-23 07:31:41
【问题描述】:
我有下一个模块:payment.module.ts
@Module({
controllers: [PaymentController],
})
export class PaymentModule {}
在下一个服务中,我希望能够访问基于接口的服务
payment.service.ts
export class PaymentService {
constructor(private readonly notificationService: NotificationInterface,
}
notification.interface.ts
export interface NotificationInterface {
// some method definitions
}
notification.service.ts
@Injectable()
export class NotificationService implements NotificationInterface {
// some implemented methods
}
问题是如何基于NotificationInterface注入NotificationService?
【问题讨论】:
标签: javascript node.js typescript ecmascript-6 nestjs