小编Den*_*ing的帖子

AppModule加载之前的角加载外部配置

考虑以下情形(Angular v7):

  1. 在加载AppModule 之前,从外部端点(JSON)加载配置参数(API服务器URL和Auth服务器URL)
  2. 将配置传递给AppModule(OAuth2模块)
  3. 使用AOT编译应用

第二点是这里的关键,看起来像这样:

@NgModule({
  imports: [
    ...
    OAuthModule.forRoot({
      resourceServer: {
        allowedUrls: [API_SERVER_URL], // <== we need to set the value that we loaded from the external endpoint (JSON) here
        sendAccessToken: true
      }
    }),
    ...
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

我已经尝试了以下内容:

  • 使用APP_INITIALIZER的解决方案。这是行不通的,因为OAuthModule.forRoot()会在APP_INITIALIZER下载外部配置JSON 之前触发。
  • 加载配置与异步功能main.ts进入角环境变量,然后引导中的AppModule。由于中的import { AppModule } from './app/app.module';语句也无法正常工作main.ts,这会导致AppModule在加载OAuthModule.forRoot()外部配置之前加载并启动(此注释确认了此行为)。
  • 加载的AppModule动态main.ts …

typescript angular

6
推荐指数
3
解决办法
1159
查看次数

Flexbox 等高不起作用

我一直在尝试使用 Flexbox 创建一个 3 列布局,其中块的高度相同。在下面的第一张图片中,显示了预期的行为(具有讽刺意味的是,它仅适用于 IE11)。在 Microsoft Edge、Chrome 和 Firefox 中,输出如第二张图所示,这不是我想要完成的。

环顾 Stackoverflow 和 Google 后,我似乎找不到解决问题的方法。如果有人能够帮助我解决这个问题,那将不胜感激!

JSFiddle:http : //jsfiddle.net/uyvhrjjb/1/

Flexbox 右图

Flexbox 错误图像

CSS:

#threeblocks {
    width: 100%;
    overflow: hidden;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: nowrap;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-align-content: stretch;
    -ms-flex-line-pack: stretch;
    align-content: stretch;
    -webkit-align-items: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
}


#threeblocks .block {
    -webkit-order: 0;
    -ms-flex-order: 0;
    order: 0;
    -webkit-flex: 0 1 auto;
    -ms-flex: 0 1 …
Run Code Online (Sandbox Code Playgroud)

html css flexbox

3
推荐指数
1
解决办法
4121
查看次数

标签 统计

angular ×1

css ×1

flexbox ×1

html ×1

typescript ×1