title: Selecting "Select All" also emits onDeSelectAll event in angular2-multiselect-dropdown
body: <p>I am using angular2-multiselect-dropdown. Whenever I click &quot;SelectAll&quot; in the dropdown, it doesnt select all because it is also emiting deSelectAll event and so it also calls onDeSelectAll() function. And so its not implementing the default functionality of selecting all the items in the dropdown. Select All checkbox is also not checked. Please tell me how can I make this work, as I have a deadline soon.<br />
  <a href="https://i.stack.imgur.com/WRI1a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WRI1a.png" alt="enter image description here" /></a>
  ts:</p>
  <pre><code>  ngOnInit() {
      this.dropdownList = [
        { id: 1, itemName: &quot;Pacemaker1&quot;, value: &quot;Pacemaker1&quot; },
        { id: 2, itemName: &quot;Pacemaker2&quot;, value: &quot;Pacemaker2&quot; },
        { id: 4, itemName: &quot;Pacemaker2&quot;, value: &quot;Pacemaker2&quot; },
      ];
  
      this.selectedItems = [];
  
      this.dropdownSettings = {
        singleSelection: false,
        text: &quot;Select devices&quot;,
        selectAllText: &quot;Select All&quot;,
        unSelectAllText: &quot;UnSelect All&quot;,
        enableSearchFilter: true,
        badgeShowLimit: 3,
      };
      this.getStudies();
    }
  
    onItemSelect(item: any) {
      this.selectedItems.push(item);
    }
  
    OnItemDeSelect(item: any) {
      this.selectedItems = this.selectedItems.filter((el) =&gt; el.id !== item.id);
    }
  
    onSelectAll(items: any) {
      console.log(&quot;select&quot;, items);
      this.selectedItems = [];
      this.selectedItems.push(items);
    }
  
    onDeSelectAll(items: any) {
      console.log(&quot;deselect&quot;, items);
      this.selectedItems = [];
    }
  </code></pre>
  <p>html:</p>
  <pre><code> &lt;div class=&quot;form-group&quot;&gt;
      &lt;label class=&quot;form-col-form-label&quot;&gt;
         Associated Devices
      &lt;/label&gt;
      &lt;angular2-multiselect
          class=&quot;form-control&quot;
          [data]=&quot;dropdownList&quot;
          [settings]=&quot;dropdownSettings&quot;
          (onSelect)=&quot;onItemSelect($event)&quot;
          (onDeSelect)=&quot;OnItemDeSelect($event)&quot;
          (onSelectAll)=&quot;onSelectAll($event)&quot;
          (onDeSelectAll)=&quot;onDeSelectAll($event)&quot;
          formControlName=&quot;associatedDevices&quot;&gt;
      &lt;/angular2-multiselect&gt;
   &lt;/div&gt;
  </code></pre>
  <p>Please check the replicated functionality here
  <a href="https://stackblitz.com/edit/angular-ivy-esame2?file=src%2Fapp%2Fapp.component.html" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-ivy-esame2?file=src%2Fapp%2Fapp.component.html</a></p>