小编leo*_*eox的帖子

自定义 PWA 版本管理

一般可以获取 pwa 应用程序的 onload 事件。我的意思是我们已经实现了自定义版本控制逻辑,以便根据数据库字段保持应用程序版本。(即清除 Service Worker 缓存)。这里的问题是逻辑几乎可以工作,但是当数据库中更新了新版本时,我们需要清除相应浏览器的缓存以触发更新。在更多调查中,我发现当 pwa 应用程序打开时,它会保留某种缓存图像,再次重新打开 pwa 应用程序不会触发应用程序的启动代码,而是从缓存加载应用程序。

那么是否有可能为 pwa 获得 onload 类型的事件?

出于测试目的,我在应用程序组件中添加了一些 alert(),但在重新打开 pwa 应用程序时没有触发

this.httpService.GetAppVersion(ver).subscribe(
        res => {
          if (res != null || res !== undefined) {
            this.version = res.versionNumber;
            ver = localStorage.getItem("appVersion");
            if (ver === null || ver === undefined) {
              localStorage.setItem("appVersion", "1.0");
              ver = "1.0";
            }

            let localVersion = ver.split(".");
            let incomingVersion = this.version.split(".");
            let result = this.helperService.compareVersion(
              localVersion,
              incomingVersion
            );
            //alert("result : " + result);
            if (result === 1) { …
Run Code Online (Sandbox Code Playgroud)

versioning onload-event progressive-web-apps angular7

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

如何以编程方式禁用浏览器记住密码功能?

我知道这是一个相当古老的话题,并且已经在多个线程中得到了回答。但我认为提出的解决方案在 2020 年 2 月没有一个有效。

我们如何以编程方式禁用将密码保存到浏览器功能。

我已经看到线程指定使用 autocomplete="off",不幸的是现在不起作用。(适用于 Chrome,但不适用于 Safari 和 Firefox)。

我还添加了同样不起作用的隐藏输入。

我还尝试过将输入类型设置为文本并屏蔽输入(只是尝试,我意识到安全风险),但这也适用于 Chrome 和 Firefox,但不适用于 Safari。

我正在寻找适用于 chrome、safari 和 firefox 的解决方案。

顺便说一下,目前我正在寻找一个有角度的项目来解决这个问题。

javascript safari firefox angular

5
推荐指数
0
解决办法
809
查看次数

在 Angular 项目的 bootstrap 中创建 Modal 对象的实例时,bootstrap 下拉菜单不起作用

在创建我们在节点模块中拥有的任何 Modal、Popover 等实例后,Bootstrap 下拉菜单突然不起作用。我想做的是利用 Modal 类中的 show 方法来打开引导模式。

我正在使用 Bootstrap 4.6 和 Angular 12

下拉代码 `3

<div class="dropdown-menu notification-menu-container p-0 m-0">
    <div class="dropdown-body d-flex flex-column justify-content-between align-items-stretch">
        <div class="notification">
            <div class="card m-3">
                <div class="card-body">
                  This is some text within a card body.
                </div>
              </div>
        </div>
        <div class="notification">
            <div class="card m-3">
                <div class="card-body">
                  This is some text within a card body.
                </div>
              </div>
        </div>
        <div class="notification">
            <div class="card m-3">
                <div class="card-body">
                  This is some text within a card body.
                </div>
              </div> …
Run Code Online (Sandbox Code Playgroud)

drop-down-menu bootstrap-modal bootstrap-4 angular

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

Live relod 无法在 Angular 的 vscode 开发容器中工作

我一直在使用 VScode 开发容器以角度方式开发模拟应用程序。为此,我创建了一个 docker,并使用“添加开发容器配置文件”选项创建了 devcontainer.json。

除了 Angular 的实时重新加载功能之外,一切都运行良好。因此,我被迫停止服务并使用 ngserve 命令再次运行它。

以下是我使用过的示例 docker 文件

FROM node:alpine

RUN npm install -g @angular/cli

EXPOSE 80
Run Code Online (Sandbox Code Playgroud)

devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.3/containers/docker-existing-dockerfile
{
    "name": "Existing Dockerfile",

    // Sets the run context to one level up instead of the .devcontainer folder.
    "context": "..",

    // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
    "dockerFile": "../Dockerfile",

    // Set *default* container specific settings.json values …
Run Code Online (Sandbox Code Playgroud)

livereload visual-studio-code angular vscode-devcontainer

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

是否可以在 ng serve 之前和在 angular 7 中实时重新加载/自动重新加载之前运行自定义脚本?

我必须在从 angular cli 启动 ng serve 命令之前以及在 angular live reload/auto reload 之前运行自定义脚本?除了修改 package.json 之外,是否可以使用 angular 7+?

angular-cli angular

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

我们如何在 angular 服务中使用 forwardRef 来避免循环依赖?

我已经阅读了几篇关于在 angular 中解决循环依赖的文章,所有文章都提到了使用 forwardRef 来解决循环依赖。我在网上找到的所有参考资料都只涉及组件服务交互。

我的场景是这样的:

如果两个服务相互依赖并且导致类循环依赖问题。我找不到与使用 forwardRef 相关的适当线程或任何解决两个服务之间循环依赖的最佳方法。

如果有人遇到任何此类类似的问题并就如何处理此问题提出建议,那将是可观的。

我知道循环依赖是可以避免的,但是如果我们需要以适当的方式进行,那么我应该采用什么方法?

谢谢

forward-reference angular-services angular

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

azure devops 管道任务中 Docker@0、Docker@1 和 Docker@2 有什么区别?

我可以找到任何解释 Docker@0、Docker@1 等之间差异的微软文档。我可以看到这些之间存在一些差异,例如 azureSubscription 属性仅在 Docker@0 中可用,而标签通常仅在 Docker@ 中找到2.

到目前为止,唯一可用的链接是链接

azure docker azure-devops azure-pipelines

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

找不到AddCommandLine .netcore 2.1

当我试图在ConfigurationBuilder上调用AddCommandLine()函数时,我收到指定的语法错误

  • IConfigurationBuilder没有定义或不包含扩展方法AddCommandLine接受第一个参数为IConfigurationBuilder

项目是.NetStandard 2.0

环境:

  • .net核心2.1
  • .net标准2.0
  • 操作系统:窗口10

代码段:

var config = new ConfigurationBuilder()
            .AddEnvironmentVariables()
            .AddCommandLine(args)
            .Build();
Run Code Online (Sandbox Code Playgroud)

注意:尝试使用Microsoft.Extensions.Configuration中的ConfigurationBuilder

.net-standard-2.0 asp.net-core-2.1

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