小编Ton*_*Ngo的帖子

如何在带有来自操作的道具 (MemoizedSelectorWithProps) 的选择器效果中使用 withLatestFrom

我有一个带有 props 的选择器(类型为 MemoizedSelectorWithProps)。我想在 WithLatestFrom 内的效果中使用它。问题是 - 选择器的参数(道具)来自操作负载。我无法使 withLatestFrom 访问操作有效负载。

我正在使用 Angular 7(当然还有 ngrx7)。我尝试使用地图以某种方式创建一个新的可观察对象,但没有任何效果......

这些是我在这里写的一些演示行,以简化我的用例:

行动:

export const GET_INVENTORY = '[App] Get Inventory';

export class GetInventory implements Action {
  readonly type = GET_INVENTORY;
  constructor (public branchId: number) {} 
}
Run Code Online (Sandbox Code Playgroud)

影响:

@Effect()
getInventory$ = this.actions$.pipe(
  ofType(GET_INVENTORY)
  withLatestFrom(this.store$.pipe(select(getIsStoreInventoryLoaded, {branchId: action.branchId}))), // this is not working obviously, since action is unknown
  switchMap([action, loaded]: [GetInventory, boolean] => {
  if (loaded) {
    console.log('already loaded inventory for this branch', action.branchId);
  } else {
    console.log('never loaded inventory …
Run Code Online (Sandbox Code Playgroud)

javascript rxjs typescript ngrx angular

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

ASP.Net Core-在项目中哪里可以找到Nuget软件包的安装列表

我有一个ASP.Net Core 2.2申请。

MyApp.Sln

  • MyApp.API(基于ASP.Net Core 2.2 API的项目)
  • MyApp.Services(CL类库)
  • MyApp.Contracts-(CL类库)
  • My.Services.Tests-(CL类库)

以上项目安装了不同的库(NuGet包

在.Net框架中,我们曾经用packages.configthats列出了带有版本详细信息的nuget软件包。

在哪里可以找到.Net Core 2.2中的相同详细信息?

因为一个sln中的不同项目不应具有不同版本的NuGet。

谢谢!

c# nuget asp.net-core asp.net-core-2.2

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

ASP.NET Core 3.0 [FromBody]字符串内容返回“无法将JSON值转换为System.String。”

在ASP.NET Core 3.0中使用[FromBody]字符串内容会ApiController返回验证错误:

{"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
 "title":"One or more validation errors occurred.",
 "status":400,
 "traceId":"|9dd96d96-4e64bafba4ba0245.",
 "errors":{"$":["The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1."]}}
Run Code Online (Sandbox Code Playgroud)

当客户端发布具有content-type的数据时: application/json

如何在.NET Core 3.0的api控制器中以字符串形式获取原始json数据?无需客户端更新其内容类型?

c# asp.net-core

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

Cron 表达式:在 ASP.Net Core 中每天运行一次任务

我的asp.net core程序需要收集前一天访问网站的所有IP。

当一天结束时,我需要将 IP 列表输出到 txt 文件。

因此,程序应该每天运行一次保存 IP 列表的方法。

我应该如何设计它?

在我看来,我会在 中添加一个循环任务startup.cs,并将 设为Task.Delay24 小时(一天)。

我应该这样做吗?谢谢。

c# cron asp.net-core-mvc .net-core asp.net-core

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

Angular v8抛出错误未检测到匹配的服务工作者

使用带有 angular v8 的 service worker 时,我总是遇到如下错误,这在 v7 中没有发生

在此处输入图片说明

下面是我的配置

包.json

    "@angular/animations": "~8.2.14",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/pwa": "^0.900.2",
    "@angular/router": "~8.2.14",
    "@angular/service-worker": "~8.2.14",
Run Code Online (Sandbox Code Playgroud)

angular.json

"assets": [
    "src/assets/favicon.ico",
    "src/assets",
    "src/manifest.json"
],
"configurations": {
    "production": {
        // other is ommitted
        "serviceWorker": true,
        "ngswConfigPath": "ngsw-config.json"
    }
}
Run Code Online (Sandbox Code Playgroud)

ngsw-config.json

{
    "$schema": "./node_modules/@angular/service-worker/config/schema.json",
    "index": "/index.html",
    "assetGroups": [
      {
        "name": "app",
        "installMode": "prefetch",
        "resources": {
          "files": [
            "/assets/favicon.ico",
            "/manifest.json",
            "/*.css",
            "/*.js"
          ]
        }
      }, {
        "name": "assets",
        "installMode": …
Run Code Online (Sandbox Code Playgroud)

javascript service-worker progressive-web-apps angular angular8

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

ts 文件内的函数

我正在尝试获取一个函数,通过单击按钮将字符串记录到控制台。我在使用 Angular 时在打字稿文件中编写该函数。我不断收到错误消息,提示该函数尚未定义,但我不知道哪里出了问题

ngOnInit() {
  function myFunction(){
      console.log('button has been clicked');
} 
Run Code Online (Sandbox Code Playgroud)
resume:1 Uncaught ReferenceError: myFunction is not defined
    at HTMLButtonElement.onclick
Run Code Online (Sandbox Code Playgroud)

angular

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

这个问题的答案是什么?

我从一次有角度的采访中得到一个问题。面试官问这个代码在角度上是什么意思?

码;

<app-main [type]="text"></app-main>
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular angular8

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