How to close modal using a button inside component

2 posts, 0 answers
  1. Gek Teng
    Gek Teng avatar
    2 posts
    Member since:
    Jul 2017

    Posted 28 Aug Link to this post

    Hi,

    With reference to using component with dialog service (http://www.telerik.com/kendo-angular-ui/components/dialog/service/#toc-usage), I have a form inside the component and I would like to submit the form and close the modal using a button from inside the component rather than using the action buttons.

    How should I go about achieving that?

    Please refer to the following plunker: 

    http://plnkr.co/edit/Qq50UCo0jTaqUBYI4hq3?p=preview

    Thanks.
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2513 posts

    Posted 31 Aug Link to this post

    Hello Gek,

    There are multiple ways to achieve this, depending on your requirements and preference.

    If you need the button to be styled consistently as buttons in other dialogs, it can trigger actions on the child component. To achieve this, subscribe to the dialog result and call methods on the component instance, as shown in this plunker snippet.

    If you need the button to be inside the nested component, you can trigger an event and bind the dialog close action to it, as shown in this plunker.

    Regards,
    Alex Gyoshev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top