小编Ser*_*nar的帖子

使用 Bicep 创建 Azure 资源组

我正在尝试使用文件创建 Azure 资源组.bicep

targetScope = 'subscription'

param environment string
param location string = deployment().location

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'snapshot-generator-${environment}-west-eu'
  location: location
}
Run Code Online (Sandbox Code Playgroud)

对于部署,我在 PowerShell 中使用以下命令:

New-AzResourceGroupDeployment  -TemplateFile resourceGroup.bicep
Run Code Online (Sandbox Code Playgroud)

但请求了 ResourceGroupName,我无法理解为什么以及我做错了什么。

azure azure-resource-group azure-bicep

8
推荐指数
1
解决办法
8706
查看次数

如何在 Angular 应用程序中为 localhost 配置 Microsoft Clarity

localhost我正在尝试配置 Microsoft Clarity 以在我的 Angular 应用程序中运行。

当我在 Microsoft Clarity 门户上创建新项目时,我将 URL 设置为localhost(我也尝试过localhost:4200),然后复制脚本并将其粘贴到<header>ofindex.html页面中,但似乎没有执行任何操作(没有collect调用在网络选项卡中,门户中没有日志)。

我找不到我做错了什么。或者 Microsoft Clarity 无法使用localhost

angular ms-clarity

5
推荐指数
1
解决办法
1289
查看次数

NgRx 数据 DefaultDataServiceConfig

我刚刚开始在我的项目中使用NgRx Data,我搜索了几个小时,但找不到我面临的问题的解决方案。

我正在尝试使用DefaultDataServiceConfig来更改调用的默认根,如下所示:

应用程序模块.ts

export const defaultDataServiceConfig: DefaultDataServiceConfig = {
  root: `${environment.apiUrl}/`,
};

@NgModel({
   ...
   providers: [
      {
         provide: DefaultDataServiceConfig
         useValue: defaultDataServiceConfig
      }
   ]
});
Run Code Online (Sandbox Code Playgroud)

环境.ts

export const environment = {
   ...
   apiUrl: 'https://my-api.com/v1',
};
Run Code Online (Sandbox Code Playgroud)

但是,调用将转到localhost http://localhost:3000/client/list而不是my-api.com https://my-api.com/v1/client/list

我缺少什么吗?我找不到任何示例,而且ngrx.io文档也很糟糕。

ngrx angular angular-ngrx-data

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

如何在5个以上的动作中使用ofType?

我必须在超过5个动作中使用ofType。

@Effect()
  applyInspectionsFilters$: Observable<Action> = this.actions$.pipe(
    ofType(
      InspectionsPageActions.applyInspectionsFilters.type,
      InspectionsPageActions.clearSelectedInspectionsFilters.type,
      InspectionsPageActions.removeSelectedStatusFilter.type,
      InspectionsPageActions.removeSelectedAttributeFilter.type,
      InspectionsPageActions.removeSelectedUserFilter.type,
      InspectionsPageActions.removeNotAssignedUsersFilter.type
    ),
    withLatestFrom(
      this.store$.pipe(select(fromInspections.getSelectedInspectionsFilters))
    ),
    switchMap(([action, filters]) =>
      ...
    )
  );
Run Code Online (Sandbox Code Playgroud)

当其库中参数的最大数量为5时,该怎么办?

typescript ngrx ngrx-effects angular

2
推荐指数
1
解决办法
164
查看次数

使用 Bicep 设置 Azure 存储帐户装载路径

以前,使用 Azure CLI 脚本,我有以下存储帐户配置:

az webapp config storage-account add \
  --resource-group $resourceGroup \
  --name $functionAppName \
  --storage-type AzureFiles \
  --share-name $shareName \
  --custom-id $shareId \
  --account-name $AZURE_STORAGE_ACCOUNT \
  --mount-path $mountPath \
Run Code Online (Sandbox Code Playgroud)

现在,我尝试用 Bicep 编写此内容,但我找不到mount-path. 是否有可能在 Bicep 文件中设置它?

azure azure-storage azure-resource-manager azure-web-app-service azure-bicep

2
推荐指数
1
解决办法
1682
查看次数

ngx-charts-bar-horizo​​ntal 数据标签格式

我正在使用ngx-charts更准确的bar-horizo​​ntal。我想要做的是格式化数据标签并在最后添加 % 。我曾尝试使用[xAxisTickFormatting]但它不起作用,因为从我注意到的情况来看,我的值不在ngx-charts-x-axis 上,而是在ngx-charts-series-horizo​​ntal 上

ngx-charts 用作波纹管:

<ngx-charts-bar-horizontal 
*ngIf='givesEnergyChartData && givesEnergyDataColorScheme'  
[scheme]="givesEnergyDataColorScheme"
[results]="givesEnergyChartData"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[legend]="showLegend"
[view]="viewGiveEnergy"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[showDataLabel]="showDataLabel">
</ngx-charts-bar-horizontal>
Run Code Online (Sandbox Code Playgroud)

我也试过格式化数据数组(我知道这很愚蠢,但我试过:))

this.givesEnergyChartData = this.statistic.givesEnergyData.map(
 s => {
   return { name: s.name, value: s.count } 
 });
Run Code Online (Sandbox Code Playgroud)

通过添加值: s.count + '%'

那么,我应该怎么做才能格式化数据标签并在值后添加“%”?

这是我的图表

charts typescript ngx-bootstrap angular ngx-charts

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

RxJs 监听滚动并获取两个方向的第一个发射

我需要在我的应用程序中实现变形浮动按钮功能。

我已经创建了所需的 CSS 类,现在我需要监听元素滚动以便能够应用一些样式。

我已经成功地实现了这一点,如下所示,并且效果很好:

fromEvent(scrollableElement, 'scroll')
.pipe(untilDestroyed(this), debounceTime(100))
.subscribe(() => {
     const currentScrollPos = scrollableElement.scrollTop;

     buttonTextElement.classList.toggle('d-none', prevScrollPos < currentScrollPos);

     prevScrollPos = currentScrollPos;
});
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试从性能角度改进这一点,我正在考虑以下场景:

  1. 听滚动
  2. 仅进行向下滚动的第一次发射并跳过其余部分直到向上滚动
  3. 仅进行向上滚动的第一次发射并跳过其余部分直到向下滚动
  4. 重复

是否有可能使用 RxJs 运算符来做到这一点?

rxjs typescript angular

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