Angular 具有两个公钥的角度条带实现取决于帐户类型
我有两个条带公钥,这可能取决于用户将在哪个国家付款 在my environment.ts文件中Angular 具有两个公钥的角度条带实现取决于帐户类型,angular,typescript,Angular,Typescript,我有两个条带公钥,这可能取决于用户将在哪个国家付款 在my environment.ts文件中 export const environtment = { MY_PUBLIC_KEY_CH: 'chqwqw32323erwrerererkey', MY_PUBLIC_KEY_US: 'usqwqw32323erwrerererkey', } 在我的app.module.ts文件中 import { NgxStripeModule } from "ngx-stripe";
export const environtment = {
MY_PUBLIC_KEY_CH: 'chqwqw32323erwrerererkey',
MY_PUBLIC_KEY_US: 'usqwqw32323erwrerererkey',
}
在我的app.module.ts文件中
import { NgxStripeModule } from "ngx-stripe";
@NgModule({
imports: [NgxStripeModule.forRoot(
if(accountType === 'China_Account') {
environment.MY_PUBLIC_KEY_CH
} else if(accountType === 'US_Account'){
environment.MY_PUBLIC_KEY_US)
}]})
有可能实现两个关键点吗?
我不知道如何实现双公钥。请帮忙。
谢谢。我使用旧的StripeService解决了这个问题 从'@app/shared/models/Group'导入{Group} 从“@app/shared/services/api services/group.service”导入{GroupService} 导出类详细信息组件实现OnInit{ 组类型:组
constructor(
private groupService: GroupService,
private stripeApiService: StripeApiService,
private stripeService: StripeService)
{ }
ngOnInit() {
this.service.getGroup(this.storedUser.Group).subscribe(group => {
this.groupType = group;
if(group.AccountType === 'China_Account'){
this.stripeService.setKey(environment.MY_PUBLIC_KEY_CH);
} else {
this.stripeService.setKey(environment.MY_PUBLIC_KEY_US);
}
})
}}