title: passing parameters in ngClass conditional function
body: <p>I have a users selection slider that has list of users with their name and profile picture. And i am trying to create a selection and deselection mechanism for user's slider.</p>
  
  <p>I have an array of users that i am using <code>*ngFor</code> to parse. When any of those users is clicked i am adding class "active" to <code>&lt;li&gt;</code> containing user (clicked for second time and class is removed.) info for current user in <code>*ngFor</code>. I am also making an array of user id's which are clicked and removing the id's that are clicked for a second time.</p>
  
  <p>Now if any object of "helpers" array (another array that is defined in component. Both users array and helpers array is coming from server as JSON) has user id equal to user in current iteration then "active" class should be added automatically while view is being rendered.</p>
  
  <p>I am using *ngClass to add "active" class like this <code>[ngClass]="{active: checkIfUserIsHelper(friend.id, helpers)}"</code>. But the problem is that i cannot access helpers in <code>checkIfUserIsHelper</code> function. that is in my component. I have tried to access helpers via <code>this.helpers</code> but its not working as well.</p>
  
  <p>my html:</p>
  
  <pre><code>&lt;ul class="slides"&gt;
    &lt;li class="select {{friend.id}}" [ngClass]="{active: checkIfUserIsHelper([friend.id], [helpers])}" *ngFor="let friend of friendsList" (click)="addHelper(friend)"&gt;
      &lt;div class=""&gt;
        &lt;img src="{{friend.profile_image}}" alt="user-img" /&gt;
        &lt;p class="flex-caption"&gt;{{friend.full_name}}&lt;/p&gt;
      &lt;/div&gt;
    &lt;/li&gt;
    &lt;li *ngIf="friendsList == false" &gt;No friends found&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>my function checkIfUserIsHelper:</p>
  
  <pre><code>checkIfUserIsHelper(id: number, helpers: any){
      console.log("Parameters: ",id, helpers);
      //Logic to check presence in array goes here
      return false;
    }
  </code></pre>
  
  <p>my function addHelper:</p>
  
  <pre><code>addHelper(data: Object) {
      let index = this.helpers.indexOf(data);
      if (index &gt;= 0) {
        this.helpers.splice(index, 1);
      } else {
        this.helpers.push(data);
      }
  }
  </code></pre>
  
  <p>if i use [ ] around helper in function call then friends is undefined.</p>
  
  <p>How do i solve add class to selected users and add them to array?</p>
  
  <p>Is my approach correct? </p>