1

I planning to serve my Angular index.html with express.

Is it possible to make a call to service which can populate a node model. Then pass this model value to index.html.

For example, I call a service from a trusted source within our compnay that gives me back a few files which I will write to the index file.

I could do this in JavaScript with index.html at runtime, but I think it woud be better if the node server did this as it bootstrapped and served the index.html.

I cannot seem to find how this is done or a common approach.

I have done this before in a .NET/Angular app but this Node/Express is a new approach for me.

thanks

Jordan McDonald
  • 1,101
  • 3
  • 14
  • 24
  • Could you just call the service from your angular4 component when the application is being requested in the browser? – Sonu Kapoor Jul 28 '17 at 02:22
  • I tried that but I am getting some errors and I think it might be because of the nature of injecting into the elements at run time instead of bootstrapping with by the server. I think it could probably end up working but doesn't seem clean. Was hoping for something similar to what I did in .NET using the MVC model which is populated by the server side as the app loads – Jordan McDonald Jul 28 '17 at 02:26
  • Take a look at https://stackoverflow.com/questions/43319229/angular-2-bootstrap-application-from-external-data thread and see if that helps. – Sonu Kapoor Jul 28 '17 at 02:31

0 Answers0