在 ng-bootstrap 中保存 popover 表单内容 (Angular 2+)

Save popover form content in ng-bootstrap (Angular 2+)

是否可以在弹出窗口中输入并保留字段值?

如果我单击弹出窗口按钮并在输入字段中键入内容,当他们关闭弹出窗口时输入字段会被清除

如果不能用 ng-bootstrap...它可以用 ngx-bootstrap 吗?

Demo is here

<ng-template #popContent>
  Hello, <b>{{name}}</b>!
  <input type="text">
</ng-template>
<ng-template #popTitle>
    Fancy <b>content!!</b>
</ng-template>
<div style="text-align:center">
  <button type="button" class="btn btn-outline-secondary" [ngbPopover]="popContent" [autoClose]="'outside'" [popoverTitle]="popTitle">
    I've got an input field!
  </button>
</div>

是的,这是可能的,我们需要定义一个本地 属性 用作输入字段的 ngModel。通过这种方式,它们将被捆绑在一起,您可以以任何方式传递该值。

https://stackblitz.com/edit/angular-fyhdcf-ukrs4a