1

In the LoopBack 3 docs, it was possible to pass the application object in [model].app (e.g. Book.app).

How can I access the application object in the same way in LoopBack 4?

I'm trying to dynamically (at runtime) create a controller from another controller:

app.controller(BookController);
Rifa Achrinza
  • 1,555
  • 9
  • 19

1 Answers1

2

It is possible to use constructor dependency injection on any class that's binded to the lb4 app:

constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) app: Application,
) {}

Further reference

Rifa Achrinza
  • 1,555
  • 9
  • 19