angular 2 app on azure read app settings

前端 未结 2 957
余生分开走
余生分开走 2021-01-14 14:15

I want to deploy an angular 2 app to different web app slots (let\'s say dev, staging and prod) using VSTS CI/CD. Each slot should point to a different web api. Normally one

2条回答
  •  [愿得一人]
    2021-01-14 14:55

    Only backend language can access APP Settings as environment variables at runtime. As Angular 2 is on the front side, we can't directly read these settings from front-end. A workaround to it is read app settings via backend which exposes an endpoint, then access this endpoint via AJAX call in your Angular 2 app.

    You can check out my earlier post where I posted PHP sample code to read APP Settings.

提交回复
热议问题