-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
453 additions
and
188 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { APP_INITIALIZER } from "@angular/core"; | ||
import { ConfigService } from "./config.service"; | ||
import { RouterService } from "./dynamic-routing/router.service"; | ||
import { EntityConfigService } from "../entity/entity-config.service"; | ||
import { Router } from "@angular/router"; | ||
|
||
export const APP_INITIALIZER_PROPAGATE_CONFIG_UPDATES = { | ||
provide: APP_INITIALIZER, | ||
useFactory: | ||
( | ||
configService: ConfigService, | ||
routerService: RouterService, | ||
entityConfigService: EntityConfigService, | ||
router: Router, | ||
) => | ||
async () => { | ||
// Re-trigger services that depend on the config when something changes | ||
configService.configUpdates.subscribe(() => { | ||
routerService.initRouting(); | ||
entityConfigService.setupEntitiesFromConfig(); | ||
const url = location.href.replace(location.origin, ""); | ||
router.navigateByUrl(url, { skipLocationChange: true }); | ||
}); | ||
}, | ||
deps: [ConfigService, RouterService, EntityConfigService, Router], | ||
multi: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
APP_INITIALIZER, | ||
Injector, | ||
ɵcreateInjector as createInjector, | ||
} from "@angular/core"; | ||
import { environment } from "../../../environments/environment"; | ||
|
||
/** | ||
* Provide this in the app module to run the demo data generation with lazy-loading | ||
* (no download of module code if not in demo mode). | ||
*/ | ||
export const APP_INITIALIZER_DEMO_DATA = { | ||
provide: APP_INITIALIZER, | ||
useFactory: (injector: Injector) => async () => { | ||
if (environment.demo_mode) { | ||
const m = await import("./demo-data.module"); | ||
await createInjector(m.DemoDataModule, injector) | ||
.get(m.DemoDataModule) | ||
.publishDemoData(); | ||
} | ||
}, | ||
deps: [Injector], | ||
multi: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.