Comments (4)
@pjmagee I chosen one of my projects as a victim and upgraded the ngrx to v4.0
. It took a few hours, but got it running somehow. I tried to get the state of an object which comes from ngx-config (language) and resulted OK.
Well, resulted OK
is such a very generic expression - I'm aware of that.
Is it possible for you to post the repro steps (github, plunkr, etc) so that I can try to have a look. Well, it might be a commercial project, or could take much time to elaborate even a smaller version.
I'll try to integrate ngrx v4.x
to ng-seed/universal on the upcoming weeks (might be even closer, but don't want to cite a very precise and optimistic time) and maybe it could give you some clue.
from ngx-config.
@pjmagee you can have a look at ng-seed/universal, commit 6a50aac which closes fulls1z3/universal#70.
from ngx-config.
@pjmagee I think I understood what you meant. It seems like @ngrx
began to use APP_INITIALIZER
to resolve the effects before the app gets bootstrapped - as @ngx-config
does. However, there's no interface which allows to prioritize the execution of functions supplied by the APP_INITIALIZER
.
I would recommend to change the order of imports (at the app.module.ts, in NgModule section for instance) and see those values are still undefined or not.
Also try to update this post after you make some tries, and meanwhile I'll see what can I do for this.
from ngx-config.
I always ensure the ConfigModule
is defined first in the imports list. Then I define near the bottom my EffectsModule
. It seems like I'm looking for something now called ngrxOnRunEffects
ngrx/platform#174
Essentially my problem is, I have a UserEffects
that has a Security Service
which takes the ngx-config service. This Security service has end points required for the user to login (I use Identity Server 4) so I need external endpoints to manage authentication. So this configuration really does need to happen before ANY ngrx effects are triggered. Because my Security Service is injected into multiple Effects I have.
I'm not sure how this ngrxOnRunEffects solve my problem, because my Security service is already injected into the Effect at that point. I can try to defer calling the config service GetSettings function and see how it plays out.
No matter what I try, it just appears that ConfigService never has the keys/values set in time, even once the page has rendered. So yeah, not sure how I can do this.
class Effects {
constructor(securityService: SecurityService) { }
}
class SecurityService {
constructor(configService: ConfigService) { }
// configService getSettings() undefined v4.0
// configService getSettings() defined perfectly pre v4.0 using RunAfterBootstrap
}
@NgModule({ imports [
ConfigModule.forRoot({ // produces my ConfigService from Http to be injected into any Service
provide: ConfigLoader,
useFactory: (createConfigLoader),
deps: [Http, [ORIGIN_URL]]
}),
...,
EffectsModule.forRoot(EFFECTS) // new ngrx v4.0 (config settings always undefined)
// Effects.RunAfterBootstrap(Effects) // pre ngrx v4.0 (config settings worked fine)
]})
class AppModule {
}
from ngx-config.
Related Issues (20)
- allow returning promise HOT 7
- testing issue with config.json HOT 3
- when is it planned to get @ngx-config/fs-loader: 6.0.0 on npmjs.org? HOT 7
- does http loader still work with an XHR JSON response? HOT 1
- need event/promise when config is loaded HOT 1
- ConfigModule should be importable in every module HOT 2
- Breaking changes in 8.2.0
- Function calls are not supported in decorators but 'ConfigModule' was called. HOT 6
- Version for angular 10 HOT 3
- How can you pass a configuration setting to a configurable modules forRoot method during import
- Support for Angular 12 HOT 1
- Unrichable endpoint
- rxjs subscribe deprecated - will be removed in v8
- Support for Angular 14
- provide unit tests and coverage for `fs-loader`
- module resolution error during AoT compilation
- merge-loader doesn't merge HOT 1
- make use of Google's JS and Material2 style guides
- use compodoc to generate project docs
- caching issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-config.