ng-boostrap 介绍
modal
NgbActiveModal 链接
Class
A reference to the currently opened (active) modal.
对当前打开的(active)modal 的引用,(就是现实的内容)。
Instances of this class can be injected into your component passed as modal content. So you can .update()
, .close()
or .dismiss()
the modal window from your component.
此类的实例可以注入到作为模态内容传递的组件中。所以你可以 .update()
, .close()
或者 .dismiss()
从你的组件的模态窗口。
Methods
update since 14.2.0 |
update(options: NgbModalUpdatableOptions) => voidUpdates options of an opened modal. 更新打开的模式的选项。 |
---|---|
close |
close(result: any) => void使用可选 result 值关闭模态。 The NgbModalRef.result promise will be resolved with the provided value.NgbModalRef.result 承诺将使用提供的值进行解析。 |
dismiss |
dismiss(reason: any) => voidDismisses the modal with an optional reason value.关闭具有可选 reason 值的模态。 The NgbModalRef.result promise will be rejected with the provided value.NgbModalRef.result 承诺将被拒绝,并提供的价值。 |
NgbModal 链接
Service 服务
A service for opening modal windows.
用于打开模态窗口的服务。
Creating a modal is straightforward: create a component or a template and pass it as an argument to the .open()
method.
创建模态非常简单:创建一个组件或模板,并将其作为参数传递给 .open()
方法。
Properties 性能
activeInstances |
Returns an observable that holds the active modal instances. 返回保存活动模态实例的可观察对象。 Type: EventEmitter<NgbModalRef[]> 类型: EventEmitter<NgbModalRef[]> |
---|
Methods 方法
open |
open(content: any, options: NgbModalOptions) => NgbModalRefOpens a new modal window with the specified content and supplied options. 打开包含指定内容和提供选项的新模式窗口。 Content can be provided as a TemplateRef or a component type. If you pass a component type as content,then instances of those components can be injected with an instance of the NgbActiveModal class. You can then use NgbActiveModal methods to close / dismiss modals from "inside" of your component. 内容可以作为 TemplateRef 组件类型或组件类型提供。如果将组件类型作为内容传递,则可以将这些组件的实例注入 NgbActiveModal 到类的实例中。然后, NgbActiveModal 您可以使用方法从组件的“内部”关闭/关闭模态。Also see the NgbModalOptions for the list of supported options. NgbModalOptions 另请参阅支持的选项列表。 |
---|---|
dismissAll since 3.1.0 从 3.1.0 开始 |
dismissAll(reason: any) => void Dismisses all currently displayed modal windows with the supplied reason. 关闭所有当前显示的模式窗口,并提供原因。 |
hasOpenModals since 3.3.0 从 3.3.0 开始 |
hasOpenModals() => boolean Indicates if there are currently any open modal windows in the application. 指示应用程序中当前是否有任何打开的模式窗口。 |