rangle / angular-ssr

Angular 4+ server-side rendering solution compatible with @angular/material, jQuery, and other libraries that touch the DOM (as well as providing a rich feature set!)
BSD 2-Clause "Simplified" License
279 stars 38 forks source link

TypeError: moduleFactory._injectorClass is not a constructor #46

Closed cyr-x closed 7 years ago

cyr-x commented 7 years ago

Bug: I'm running into the same Error with my repo and even with your demand-express example. It always says: TypeError: moduleFactory._injectorClass is not a constructor

The error is coming from source/platform/platform.ts line 113:

const createInjector = <M>(injector: Injector, moduleFactory: NgModuleFactory<M>): InstantiableModule<M> => new moduleFactory['_injectorClass'](injector);

The argument moduleFactory doesn't have the attribute _injectorClass, it looks like that during runtime:

NgModuleFactory_ {
  moduleType: [Function: RootModule],
  _bootstrapComponents: [ [Function: RootComponent] ],
  _ngModuleDefFactory: [Function]
}

I'm using your demand-express example.

Edit:

It's probably because of this commit https://github.com/angular/angular/commit/ce1d7c4a6e46de00fc0c4aae0d046de34d6a8395, they removed the _injectorClass attribute from NgModuleFactory

clbond commented 7 years ago

This has been resolved in the latest builds.