小编Pål*_*vik的帖子

*ng在添加新输入元素时重置所有表单值

我有一个带有按钮的Angular2应用程序,可以为我的贷款添加另一笔贷款.我的*ngFor也非常简单:

    <div *ngFor="let loan of myLoans">
      <label>{{loan.name}}</label>
      <input type="text" name="loan.name" [(ngModel)]="loan.amount">
    </div>
Run Code Online (Sandbox Code Playgroud)

myLoans是一个带有nameamount参数的Loan对象数组.我的按钮也很简单.

<button id="addLoan" type="button" (click)="addLoan()">Legg til lån</button>
Run Code Online (Sandbox Code Playgroud)

addLoan()函数:

addLoan(): void{
    var newLoan = new Loan();
    this.myLoans.push(newLoan);
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我在列表中添加新贷款时,我在其他贷款的输入字段中的任何值都会回到0或我在贷款对象的构造函数中设置的任何值.

加载应用程序会显示此图片

现在怎么办

键入数字时,ngModel正在工作

在此输入图像描述

按下"Leggtillån"按钮后,将重置第一个输入的值

在此输入图像描述

如果我尝试输入另一个数字,ngModel仍在为第一个输入工作

在此输入图像描述

任何人都知道这里发生了什么?

data-binding typescript ngfor ng-modal angular

12
推荐指数
2
解决办法
7659
查看次数

Azure Devops 中拉取请求的构建策略是否可以使用在所述 PR 中更新的 yaml 文件?

我们将所有管道都签入了代码,但是如果我们在这些管道中更改了 PR,那么 PR 构建策略将与 MASTER 中的 YAML 文件一起运行,而不是我们想要签入 master 的文件。这基本上是一个僵局。

假设您要删除使所有 PR 失败的验证,因此您创建了一个 PR,但无法合并它,导致构建策略失败:P

PS:我知道我可以删除策略,完成合并,然后手动添加策略,但这并不是一个好的解决方案。

azure azure-devops azure-pipelines

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

由于cygwin1.dll,无法在Sourcetree中克隆存储库

尝试从BitBucket或Github克隆存储库时出现此错误.我试过重新启动计算机,重新安装Sourcetree,但没有运气.还有其他提示吗?我的电脑上只有一个cygwin1.dll文件.

0 [main] sh (8532) C:\Users\myUser\AppData\Local\Atlassian\SourceTree\git_local\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0x1180400/0x1120400. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL.

git atlassian-sourcetree sourcetree

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