angular - 在 ng-bootstrap (Angular 2+) 中保存弹出表单内容
问题描述
是否可以在弹出窗口中输入并保留字段值?
如果我单击弹出框按钮并在输入字段中键入,则在关闭弹出框时输入字段将被清除
如果 ng-bootstrap 无法使用...它可以与 ngx-bootstrap 一起使用吗?
<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。通过这种方式,它们将被捆绑在一起,您可以以任何您想要的方式传递该值。
推荐阅读
- unit-testing - 与测试中的所有可观察对象相比,如何刷新一个冷可观察对象?
- python - Adding __init__() method in Flask-SQLAlchemy
- java - doAnswer to check which class called a specific function?
- javascript - 平滑滚动不提供 React.JS 的功能(尝试了多个包)
- java - 尝试打开pdf时如何弹出窗口
- r - Amplitude lines + geom_point in ggplot2
- javascript - react-particles-js 不适用于 iframe 标签
- c# - How to create separate resource files for debugging and releasing?
- angular - 如何在 Angular 6 中调试库?
- python-3.x - 如何填充缺失的类别变量?