Dialog CORE

Examples API Setup
  1. Use open method to initiate a dialog, subscribe to a returned Observable to show it :

  2. If you want to use your own component as a dialog content, use POLYMORPHEUS_CONTEXT in it. Dialog will provide this token with some useful options: $implicit with Observer<O> and completeWith hook to call next and complete in one action.

  3. You can also use a template
  4. Use Observer from $implicit field of context to close a dialog or get some data

    TuiDialogContext<Type1 = void, Type2 = undefined> , the first type is the return type of value, for example: this.dialogs.open(...).subscribe((value: Type1) => ... ) . The second type is type of passed data to the dialog: this.dialogs.open(..., { data: Type2 }) . Accordingly, in the dialog component the context will be as follows: this.context.data: Type2 and this.context.$implicit / completeWith: Type1
  5. If you use dialog components in lazy loading modules, and want to reach for some local providers, you can pass Injector into new PolymorpheusComponent of your dialog component.