小编Ara*_*han的帖子

是否有选项可以更改material-2 stepper中已完成步骤的图标

目前,已完成步骤的图标是"创建".如何将其更改为其他材质图标行,例如"完成"?

<mat-vertical-stepper>
    <mat-step label="Agreement Preparation">
        <p>Agreement preparion is intiated by our side </p>
    </mat-step>
    <mat-step label="Ready for Biometric">
        <p>Agreement preparion is intiated by our side </p>

    </mat-step>
    <mat-step label="Document in Submission">
        <p>Agreement preparion is intiated by our side </p>

    </mat-step>
</mat-vertical-stepper>
Run Code Online (Sandbox Code Playgroud)

angular-material

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

如何将第二步设置为Material-2步进器中的活动步骤?

<mat-vertical-stepper>
<mat-step label="Agreement Preparation">
    <p>Agreement preparion is intiated by our side </p>
</mat-step>
<mat-step label="Ready for Biometric" selected active>
    <p>Agreement preparion is intiated by our side </p>

</mat-step>
<mat-step label="Document in Submission">
    <p>Agreement preparion is intiated by our side </p>

</mat-step>
Run Code Online (Sandbox Code Playgroud)

我尝试设置活动和选择但它不起作用.

angular-material angular-material2 angular

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

即使包含 --aot --build-optimizer --sourcemaps=false 后,Angular Production Build 仍然非常庞大

我的应用程序中有近 17 个模块,其大小与 Angular 生成的模块相比可以忽略不计。

chunk {common} common.chunk.js (common) 2.18 MB 
chunk {main} main.bundle.js (main) 4.42 MB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 616 KB [initial]
Run Code Online (Sandbox Code Playgroud)

我知道 Angular 生成这些块是为了处理一些内部内容,但为什么主包是 4.5 MB

我究竟做错了什么?

有什么办法可以减小这些尺寸吗?

在此输入图像描述

angular

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

在JSON中找到最小的子项

考虑像这样的JSON

{
    "products": {
        "c1": {
            "stock": 100
        },
        "c2": {
            "stock": 200
        },
        "c3": {
            "stock": 300
        },
        "c4": {
            "stock": 400
        },
        "c5": {
            "stock": 500
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

为了找到最少的库存,我写了这样的代码

 var minStock=Math.min(
      products.c1.stock,
      products.c2.stock,
      products.c3.stock,
      products.c4.stock,
      products.c5.stock
      )
  console.log(minStock);
Run Code Online (Sandbox Code Playgroud)

现在我想知道基于库存值的c1,c2,c3,c4或c5是最小的,在这种情况下说

console.log("c1 is minimum with stock 100");
Run Code Online (Sandbox Code Playgroud)

html javascript json

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

Angular 6 Service Worker 拒绝缓存资产,因为 ngsw.json 未正确获取

当前行为

我做了ng add @angular/pwa,我在生产版本中遇到了这个错误

    Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
        at Driver.<anonymous> (ngsw-worker.js:2297)
        at Generator.next (<anonymous>)
        at fulfilled (ngsw-worker.js:1752)
Run Code Online (Sandbox Code Playgroud)

截图来自 2018-07-12 16-13-32 我做了一些研究,发现/ngsw.json?ngsw-cache-bust=0.08769372894975769GET 请求存在问题 。尽管 fetchLatestManifest 返回 200 状态代码,响应实际上不是 JSON ,而是它的无脚本版本index.html

您可以看到响应状态为 200 /ngsw.json?ngsw-cache-bust=0.08769372894975769 截图来自 2018-07-12 16-18-33

但实际响应不是所需的 JSON 截图来自 2018-07-12 16-19-14

我尝试复制作为 chrome 中的 fetch 选项实际 ```

fetch("https://officehawk.com/ngsw.json?ngsw-cache-bust=0.7927584506157848", {"credentials":"omit","headers":{},"referrer":"https://officehawk.com/ngsw-worker.js","referrerPolicy":"no-referrer-when-downgrade","body":null,"method":"GET","mode":"cors"});
Run Code Online (Sandbox Code Playgroud)

``` 并且我?ngsw-cache-bust=0.7927584506157848从 fetch 的 URL 部分中删除,我可以看到响应是 JSON。

编辑了```

fetch("https://officehawk.com/ngsw.json", {"credentials":"omit","headers":{},"referrer":"https://officehawk.com/ngsw-worker.js","referrerPolicy":"no-referrer-when-downgrade","body":null,"method":"GET","mode":"cors"});
Run Code Online (Sandbox Code Playgroud)

``` 这样你就可以看到 ngsw.json 的内容了 截图来自 2018-07-12 16-35-24

我怀疑它必须在这个函数中处理? https://github.com/angular/angular/blob/0b4d85e9f19246af68a75140afc4db3d97f9ddfd/packages/service-worker/worker/src/driver.ts#L645

环境

角度版本:6.0.0

浏览器: - [x] Chrome(桌面)版本 67

service-worker angular angular-service-worker pwa

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