title: Angular 4 Passing data/parameters to a modal (using ngfor)
body: <p>i'm new to angular 4 and i'm displaying data inside an array using ngFor.Each addon has a number of users and list of these users(id,role,etc) that i managed to get from the backend(spring boot project).what i'm trying to do is display the number of these users,when the user clicks on the button displaying the number,a modal pops up and display the details of these users.
  So the problem i'm getting is how to pass the {{addon.something}} to the modal.</p>
  
  <pre><code>       &lt;tbody&gt;
              &lt;tr *ngFor="let addon of addons"&gt;
                  &lt;td&gt;{{addon.name}}&lt;/td&gt;
                  &lt;td&gt;{{addon.url}}&lt;/td&gt;
                  &lt;td&gt;{{addon.location}}&lt;/td&gt;
                 &lt;td&gt;
                   &lt;button class="btn btn-outline-primary" (click)="open(content,addon)" &gt;{{addon.users.length}}&lt;/button&gt;
                   &lt;!--{{addon.users.length}}--&gt;
                  &lt;/td&gt;
  
                  &lt;td&gt;
                      &lt;a routerLink="/assign_user_to_addon/{{addon.id}}"&gt;Add user&lt;/a&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
  </code></pre>
  
  <p>I tried to pass it into the <code>(click)="open(content,addon)"</code> ,but it's not working.</p>
  
  <p>Typescript code for handling the modal :</p>
  
  <pre><code> open(content:any,addon:any) {
      this.modalService.open(content).result.then((result) =&gt; {
  
        this.closeResult = `Closed with: ${result}`;
      }, (reason) =&gt; {
        this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
      });
    }
  
    private getDismissReason(reason: any): string {
      if (reason === ModalDismissReasons.ESC) {
        return 'by pressing ESC';
      } else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
        return 'by clicking on a backdrop';
      } else {
        return  `with: ${reason}`;
      }
    }
  </code></pre>
  
  <p>What could be the best way to pass data/parameters to a modal ?</p>