Skip to content

Instantly share code, notes, and snippets.

View Reading configuration files before application startup in Angular2 final

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

ortichon / JSInterview_3.js
Created May 19, 2017
JavaScript Interview Question #3
View JSInterview_3.js
for (var i = 0; i < 10; i++) {
setTimeout(function() { console.log(i); }, 100 * i);
ortichon / JSInterview_2.js
Last active May 28, 2017
JavaScript Interview Question #2
View JSInterview_2.js
var foo = function() {
function foo() {
ortichon / JSInterview_1.js
Last active May 27, 2017
JavaScript Interview Question #1
View JSInterview_1.js
var variables = { set number(value) { this._number = value; }, get number() { return Math.random(); } }
variables.number = 5;
console.log(variables.number === variables.number);
You can’t perform that action at this time.