You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to bind Subscriber to Angular DI like code below. But it look like not working, because this.auditsProv is always Undefined. If it's not impossible, should I have to use another DI for Subscribers like TypeDI(https://github.com/typeorm/typeorm-typedi-extensions)?
[post-subs.ts]
import { Injectable } from '@angular/core';
import { EventSubscriber, EntitySubscriberInterface, InsertEvent } from "typeorm";
import { AuditsProvider } from '../providers/audits/audits';
@Injectable()
@EventSubscriber()
export class PostSubscriber implements EntitySubscriberInterface {
I tried to bind Subscriber to Angular DI like code below. But it look like not working, because this.auditsProv is always Undefined. If it's not impossible, should I have to use another DI for Subscribers like TypeDI(https://github.com/typeorm/typeorm-typedi-extensions)?
[post-subs.ts]
import { Injectable } from '@angular/core';
import { EventSubscriber, EntitySubscriberInterface, InsertEvent } from "typeorm";
import { AuditsProvider } from '../providers/audits/audits';
@Injectable()
@EventSubscriber()
export class PostSubscriber implements EntitySubscriberInterface {
constructor(private auditsProv: AuditsProvider) {
console.log(this.auditsProv);
}
/**
*/
beforeInsert(event: InsertEvent) {
console.log(
BEFORE ENTITY INSERTED:
, event.entity);this.auditsProv.save();
}
}
[app.module.ts]
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
AuditsProvider,
PostSubscriber
]
})
export class AppModule {}
The text was updated successfully, but these errors were encountered: