I need help with getting data from my server into the Angular2 startup process. I want to configure HTTP headers for every request by using custom request options, but the header values come from my backend server.
Here’s my current index.ts setup:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { MainComponent } from "./main.component.ts";
platformBrowserDynamic().bootstrapModule(MainComponent);
I know how to send data to the main component after it starts, but I need access to server data during the bootstrap phase itself. How can I make this work?
Here’s my build configuration:
module.exports = {
entry: {
main: "./src/app/index.ts"
},
output: {
filename: "./dist/[name].bundle.js"
},
resolve: {
extensions: [".ts", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
use: 'typescript-loader'
}
]
}
};
Any suggestions would be really helpful!