作者:谷智精源 | 来源:互联网 | 2023-09-12 10:56
IvebuiltmyAngular4projectusingtheAngularCLI.IamdeployingmyapponHeroku,Ivecreated
I've built my Angular 4 project using the Angular CLI. I am deploying my app on Heroku, I've created heroku pipelines for dev and production environment. I have two firebase database dev and production and I want my angular 2 apps to connect to the firebase database based on heroku config variables
我使用Angular CLI构建了我的Angular 4项目。我正在Heroku上部署我的应用程序,我已经为开发和生产环境创建了heroku管道。我有两个firebase数据库开发和生产,我希望我的angular 2应用程序基于heroku配置变量连接到firebase数据库
I searched on google and found this answer helpful as @yoni-rabinovitch suggested to send an HTTP request on node server to check for the environment when the app initializes.
我在谷歌搜索并发现这个答案很有帮助,因为@ yoni-rabinovitch建议在节点服务器上发送HTTP请求,以便在应用初始化时检查环境。
I am a beginner in Angular 4 and typescript and all I need to implement is to send an HTTP request and initialize the firebase module based on the response.
我是Angular 4和typescript的初学者,我需要实现的是发送HTTP请求并根据响应初始化firebase模块。
app.module.ts
app.module.ts
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase)
],
bootstrap: [AppComponent]
})
export class AppModule {}
Any help would be highly appreciated
任何帮助将受到高度赞赏
1 个解决方案