NG6: library-provided service is undefined NG6: library-provided service is undefined typescript typescript

NG6: library-provided service is undefined


I guess your FooBarService is located is located inside the library.
With the new workspace structure ng6 provides, the libraries are need to be built before using them. You should 'ng build --prod' (prod because AOT) the library and then import it directly as a library, not from its sources. e.g.: import FooBarService from 'foobar-service-library';

You can read more about it here: https://blog.angularindepth.com/creating-a-library-in-angular-6-87799552e7e5


Along the same lines as this question, is it possible to use an ng6 Library in an ng5 App? I'm running into this error:

19:66-82 "export 'defineInjectable' was not found in '@angular/core' as part of the new providedIn feature that ng6 uses.