We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to open dialog from another controller function using angular js

Description:

When there is two different ng-controller one with a Dialog component and the other controller to open the dialog explicitly. To open the Dialog from other controller, we need to use ‘ng-include’ directive, ‘$includeContentLoaded’ event and ‘$broadcast’ service.

Solution:

  1. Create a ng-controller for rendering ejDialog control with angular binding.

 

  1. Create another ng-controller with angular binding and using “ng-include” directive add the “basigDialog.html”(File name of the other controller). Please refer the following code snippet.
  1. Now to check whether any external resources added, bind $includeContentLoaded event that is emitted every time a component is included to the controller. Define script to initialize dialog control in it.
  2. Using $broadcast service bind the event for the child controllers. So that you can open the Dialog from this controller.

 

 

In the above sample, we have 2 controllers separately and initiated control from controller by referring the external resource. Find the sample from the below,

 

Sample link

Article ID: Published Date: Last Revised Date: Platform: Control:
7016 07/29/2016 07/29/2016 JavaScript ejDialog
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.