I'm submitting a...
[?] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
A library with a directive that requires injection of Injector is AOT-compiled and distributed with metadata.
An app imports the library's module and applies the directive to an element.
Running the app with ng serve --aot works fine, the Injector is injected into the library directive.
Running the app with ng serve (JIT) results in error on page load:
Error: StaticInjectorError[Injector]:
StaticInjectorError[Injector]:
NullInjectorError: No provider for Injector!
Note that this is not specific to Injector, trying to inject e.g. IterableDiffers causes the same problem.
Expected behavior
The app works with both JIT and AOT.
Minimal reproduction of the problem with instructions
https://github.com/jeysal/ng5-jit-inj-repro
Follow the instructions in the readme on master to reproduce.
Branch master contains the library (with very basic build setup).
Branch app contains the app (generated by angular-cli).
Environment
Angular version: 5.0.0
Browser:
- [x] Chrome (desktop) version 62.0.3202.75 (Official Build) (64-bit)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.8.1
- Platform: Linux
Others:
I'm submitting a...
Current behavior
A library with a directive that requires injection of
Injectoris AOT-compiled and distributed with metadata.An app imports the library's module and applies the directive to an element.
Running the app with
ng serve --aotworks fine, theInjectoris injected into the library directive.Running the app with
ng serve(JIT) results in error on page load:Note that this is not specific to
Injector, trying to inject e.g.IterableDifferscauses the same problem.Expected behavior
The app works with both JIT and AOT.
Minimal reproduction of the problem with instructions
https://github.com/jeysal/ng5-jit-inj-repro
Follow the instructions in the readme on
masterto reproduce.Branch
mastercontains the library (with very basic build setup).Branch
appcontains the app (generated by angular-cli).Environment