This is a migrated thread and some comments may be shown as answers.

How to close modal using a button inside component

1 Answer 400 Views
ModalView
This is a migrated thread and some comments may be shown as answers.
Gek Teng
Top achievements
Rank 1
Gek Teng asked on 28 Aug 2017, 02:15 PM

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.

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 31 Aug 2017, 10:23 AM
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.
Tags
ModalView
Asked by
Gek Teng
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or