Closed mendezgabriel closed 6 years ago
Why don't you use Angular environment variables ?
It's a legacy app and I am making some performance improvements, not too much room for refactoring. Would you give me an example of how it would work with environment variables? BTW the project is using webpack for building, not Angular CLI :(
Here is an example : https://alligator.io/angular/environment-variables/ but it uses Angular CLI.
Maybe this can help : https://stackoverflow.com/questions/42252990/angular-2-webpack-environment-configurations
Thanks! The second article gave me some ideas 👍
Hi,
This is not an issue but more of a query since I'd like to pass some values to the Cacheable decorator dynamically. These would be defined in a config file and converted into an object. Essentially I have a service which contains several methods I'd like to cache like this:
... @Cacheable({ maxAge: this.config.cacheExpirationTimeInMilliseconds }) getCountries() { return this.http.get("api/Countries"); } ...
I'm struggling to do that, since I always get anundefined
reference on theconfig
object. What should be the proper way to do this? Or better yet, how can I override default values being used by the decorator and what are those values?Thanks in advance.