我有下一个模块:payment.module.ts
@Module({
controllers: [PaymentController],
})
export class PaymentModule {}
Run Code Online (Sandbox Code Playgroud)
在下一个服务中,我想访问基于接口的服务
支付服务.ts
export class PaymentService {
constructor(private readonly notificationService: NotificationInterface,
}
Run Code Online (Sandbox Code Playgroud)
通知.interface.ts
export interface NotificationInterface {
// some method definitions
}
Run Code Online (Sandbox Code Playgroud)
通知.service.ts
@Injectable()
export class NotificationService implements NotificationInterface {
// some implemented methods
}
Run Code Online (Sandbox Code Playgroud)
问题是我如何注入NotificationService基于NotificationInterface?