2

I recently started on implementing a hybrid app to upgrade our relatively large application from angularjs 1.5 to angular 5. The problem now is in our application.module.ts, angular.module has a config ".constant("appConfig", window.appConfig). During the time of bootstrapping from ngUpdrade, it comes to angular.module (from import statement) and register window.appConfig as undefined before it hits the logics of appConfig in our index.ejs

Because we have so many components using this appConfig constant through Dependency injection, is there a way to execute and assign the values for appConfig before import statement for application.module.ts is hit?

Tom Lai
  • 21
  • 1
  • I have fixed this by wrapping angular.module inside a function and execute this function in APP_INITIALIZER before we bootstrap the app, so when it gets to register the constant from window.appConfig. It has values for that constant! – Tom Lai Jan 24 '19 at 15:12
  • hi, @Tom can you share an example? – Vipul Aug 18 '22 at 14:28

0 Answers0