As @Thierry states above, his proposed method is only valid for passing string attributes. Below is a method by which you can pass in an object with defined properties.
Create a class for the data you want to pass.
appdata.ts
export class AppData {
public isServerRunning: boolean;
public isDataFromMemory: boolean;
}
Define an instance on the window object containing your startup data
index.html
<script>window.APP_DATA = { isServerRunning: false, isDataFromMemory: false }
Tell the bootstrap code about it.
main.tss
import { AppData } from './app/appdata';
Provide the data via a service to your components
app.module.ts
import { AppData } from './appdata';
...
providers: [AppData,
{
provide: AppData,
useValue: window['APP_DATA']
}
],
Access the data from a component
app.component.ts
constructor(appData:AppData) {
console.log('AppComponent - ', appData);
}