I have a component, which has an image. Onclick of image I want to show up a popup window and in that show values and button. I am able to extract values on click of image, but not able to find how to show them in a new window. Below is the sample code Component

<div onclick="{!c.addContact}">
     <c:svg class="slds-icon slds-icon-text-default slds-float--right" 
       xlinkHref="/resource/SLDS100/assets/icons/utility-sprite/svg/symbols.svg#adduser" />

Js Controller

addContact : function(component){      

        var action = component.get("c.displayContacts");

         action.setCallback(this, function(a){
          var list = a.getReturnValue();// the list is coming here with values
             alert('length'+ list.length);
             for(i = 0 ; i< list.length(); i++)
                alert('a' list[i].checked); // I want to show the values in the new pop up window or save it another attribute which shows up new component.

Note: The method in the Apex controller writtens a wrapper class list and I want to iterate that list and show its value. Hence I think alert wont work. Can I show a new component as a pop up. Any quick help will be much appreciated.

  • 6
    you need to create a modal component as discussed here
    – Praveen
    Apr 6, 2016 at 16:27
  • I did it using slds-modal div, and using slds-hide to hide and show. Jan 12, 2018 at 13:03

2 Answers 2


Try to modify your code.

// for(i = 0 ; i< list.length(); i++)
for(i = 0 ; i< list.length; i++) {
  //alert('a' list[i].checked);
  alert('a' + list[i].checked);

In my environment, alert works without problems.


alert works in Lightning. Your code is failing here:

for(i = 0 ; i< list.length(); i++) // change length() to length

As an alternative to alert, you can try force:showToast if you are in LEX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.