Angular 7 - Load-on-fly none routable module (shared providers/services)Load new modules dynamically in run-time with Angular CLI & Angular 5How to share service between two modules - @NgModule in angular not between to components?Angular 2 service property values undefined in my lazy loaded modulesComponents and modules exported from shared modules with forRoot option not available in lazy loaded moduleAngular 4.2.4 HttpInterceptor not working when used in forRoot() of shared moduleAngular 4.4.6 shared services in lazy loaded modulesShared Services in Angular 6 outside of Core moduleLazy loading - Providers and modulesAngular: How to mutate a core module service in a lazy loaded module?Core module component and Shared module implementation in angularAngular: Extending a Service on Lazy Loading a Module
Using a siddur to Daven from in a seforim store
How should I respond when I lied about my education and the company finds out through background check?
Customize circled numbers
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
Should I stop contributing to retirement accounts?
Fly on a jet pack vs fly with a jet pack?
Is a model fitted to data or is data fitted to a model?
Would it be legal for a US State to ban exports of a natural resource?
Does having a TSA Pre-Check member in your flight reservation increase the chances that everyone gets Pre-Check?
What is this type of notehead called?
Indicating multiple different modes of speech (fantasy language or telepathy)
Is it possible to use .desktop files to open local pdf files on specific pages with a browser?
Confusion on Parallelogram
How to align and center standalone amsmath equations?
Diode in opposite direction?
Can someone explain how this makes sense electrically?
Should I install hardwood flooring or cabinets first?
On a tidally locked planet, would time be quantized?
MAXDOP Settings for SQL Server 2014
Do Legal Documents Require Signing In Standard Pen Colors?
Can somebody explain Brexit in a few child-proof sentences?
Will adding a BY-SA image to a blog post make the entire post BY-SA?
If a character with the Alert feat rolls a crit fail on their Perception check, are they surprised?
How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?
Angular 7 - Load-on-fly none routable module (shared providers/services)
Load new modules dynamically in run-time with Angular CLI & Angular 5How to share service between two modules - @NgModule in angular not between to components?Angular 2 service property values undefined in my lazy loaded modulesComponents and modules exported from shared modules with forRoot option not available in lazy loaded moduleAngular 4.2.4 HttpInterceptor not working when used in forRoot() of shared moduleAngular 4.4.6 shared services in lazy loaded modulesShared Services in Angular 6 outside of Core moduleLazy loading - Providers and modulesAngular: How to mutate a core module service in a lazy loaded module?Core module component and Shared module implementation in angularAngular: Extending a Service on Lazy Loading a Module
I would like to load-on-fly an angular 7 module in main app to be able to share models & services in others load-on-fly routable modules (with components).
For the records, I have an app module, which includes Core and Shared modules. Thats for the "static" part. On the other side I have some modules to load-on-fly which are libraries (built to UMD files and put in assets). Its like a marketplace where you can activate some modules, add your modules...). For now I can load-on-fly some modules and make it accessible by using routing.
But I would like to export api services in an other modules to make it accessible for others components modules. Like that :
I have to load some kind of peer dependencies before loading components modules.
For now I can load api-service like I load components modules but I don't know how to access my services (like TestService).
private loadApiDependency(dep: ModuleDependency)
return SystemJS.import(`$dep.location`).then((exports) =>
const moduleNg = exports[`$dep.moduleName`];
return this.compiler.compileModuleAsync(moduleNg).then((moduleFactory: NgModuleFactory<any>) =>
const moduleRef = moduleFactory.create(this.injector);
console.log(this.injector.get('TestService'));
return moduleFactory;
);
);
My idea was to use Core module to reference all load-on-fly services. But for now I have an error to access TestService : NullInjectorError: No provider for TestService!
.
More than that, I don't really know how to reference my api in components modules. I thought I could use kind of peer dependencies, but for dev time, references will be missing...
Someone has a similar solution or an idea ?
Please do not answer me "Use lazy loading", "Put your api in core", etc..., it must be like that. Or very similar.
Many thanks.
angular module lazy-loading angular7 jit
add a comment |
I would like to load-on-fly an angular 7 module in main app to be able to share models & services in others load-on-fly routable modules (with components).
For the records, I have an app module, which includes Core and Shared modules. Thats for the "static" part. On the other side I have some modules to load-on-fly which are libraries (built to UMD files and put in assets). Its like a marketplace where you can activate some modules, add your modules...). For now I can load-on-fly some modules and make it accessible by using routing.
But I would like to export api services in an other modules to make it accessible for others components modules. Like that :
I have to load some kind of peer dependencies before loading components modules.
For now I can load api-service like I load components modules but I don't know how to access my services (like TestService).
private loadApiDependency(dep: ModuleDependency)
return SystemJS.import(`$dep.location`).then((exports) =>
const moduleNg = exports[`$dep.moduleName`];
return this.compiler.compileModuleAsync(moduleNg).then((moduleFactory: NgModuleFactory<any>) =>
const moduleRef = moduleFactory.create(this.injector);
console.log(this.injector.get('TestService'));
return moduleFactory;
);
);
My idea was to use Core module to reference all load-on-fly services. But for now I have an error to access TestService : NullInjectorError: No provider for TestService!
.
More than that, I don't really know how to reference my api in components modules. I thought I could use kind of peer dependencies, but for dev time, references will be missing...
Someone has a similar solution or an idea ?
Please do not answer me "Use lazy loading", "Put your api in core", etc..., it must be like that. Or very similar.
Many thanks.
angular module lazy-loading angular7 jit
add a comment |
I would like to load-on-fly an angular 7 module in main app to be able to share models & services in others load-on-fly routable modules (with components).
For the records, I have an app module, which includes Core and Shared modules. Thats for the "static" part. On the other side I have some modules to load-on-fly which are libraries (built to UMD files and put in assets). Its like a marketplace where you can activate some modules, add your modules...). For now I can load-on-fly some modules and make it accessible by using routing.
But I would like to export api services in an other modules to make it accessible for others components modules. Like that :
I have to load some kind of peer dependencies before loading components modules.
For now I can load api-service like I load components modules but I don't know how to access my services (like TestService).
private loadApiDependency(dep: ModuleDependency)
return SystemJS.import(`$dep.location`).then((exports) =>
const moduleNg = exports[`$dep.moduleName`];
return this.compiler.compileModuleAsync(moduleNg).then((moduleFactory: NgModuleFactory<any>) =>
const moduleRef = moduleFactory.create(this.injector);
console.log(this.injector.get('TestService'));
return moduleFactory;
);
);
My idea was to use Core module to reference all load-on-fly services. But for now I have an error to access TestService : NullInjectorError: No provider for TestService!
.
More than that, I don't really know how to reference my api in components modules. I thought I could use kind of peer dependencies, but for dev time, references will be missing...
Someone has a similar solution or an idea ?
Please do not answer me "Use lazy loading", "Put your api in core", etc..., it must be like that. Or very similar.
Many thanks.
angular module lazy-loading angular7 jit
I would like to load-on-fly an angular 7 module in main app to be able to share models & services in others load-on-fly routable modules (with components).
For the records, I have an app module, which includes Core and Shared modules. Thats for the "static" part. On the other side I have some modules to load-on-fly which are libraries (built to UMD files and put in assets). Its like a marketplace where you can activate some modules, add your modules...). For now I can load-on-fly some modules and make it accessible by using routing.
But I would like to export api services in an other modules to make it accessible for others components modules. Like that :
I have to load some kind of peer dependencies before loading components modules.
For now I can load api-service like I load components modules but I don't know how to access my services (like TestService).
private loadApiDependency(dep: ModuleDependency)
return SystemJS.import(`$dep.location`).then((exports) =>
const moduleNg = exports[`$dep.moduleName`];
return this.compiler.compileModuleAsync(moduleNg).then((moduleFactory: NgModuleFactory<any>) =>
const moduleRef = moduleFactory.create(this.injector);
console.log(this.injector.get('TestService'));
return moduleFactory;
);
);
My idea was to use Core module to reference all load-on-fly services. But for now I have an error to access TestService : NullInjectorError: No provider for TestService!
.
More than that, I don't really know how to reference my api in components modules. I thought I could use kind of peer dependencies, but for dev time, references will be missing...
Someone has a similar solution or an idea ?
Please do not answer me "Use lazy loading", "Put your api in core", etc..., it must be like that. Or very similar.
Many thanks.
angular module lazy-loading angular7 jit
angular module lazy-loading angular7 jit
asked Mar 7 at 9:19
LETOURNEUR LéoLETOURNEUR Léo
1429
1429
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040112%2fangular-7-load-on-fly-none-routable-module-shared-providers-services%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040112%2fangular-7-load-on-fly-none-routable-module-shared-providers-services%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown