title: Angular 4 ng2-file-input image size validation
body: <p>How to validate image size? (ex: less than 2MB)
  I'm using ng2-file-input for image uploading in my angular4 project.</p>
  
  <p>`</p>
  
  <pre><code>public onAction(event: any) {
  this.resImagesSize = event.currentFiles;
  for (let i = 0; i &lt; this.resImagesSize[i].size; i++) {
  if (this.resImagesSize[i].size &gt; 2000000) {
  this.toasterService.pop('error', 'Error', 'Please upload less than 2MB image');
  this.resImagesSize.splice(i, 1);
  } else {
  this.resImages = this.resImagesSize;
  }
  }
  }
  </code></pre>
  
  <p>`</p>
  
  <p><strong>Edit: here is my  toasterService code</strong>
  ` </p>
  
  <pre><code>toasterconfig: ToasterConfig =
      new ToasterConfig({
        tapToDismiss: true,
        timeout: 5000,
        preventDuplicates: false,
        positionClass: 'toast-top-center'
      });
  </code></pre>
  
  <p>`</p>
  
  <p>problem is when i upload more than 2 images(bigger than 2MB) it display 2 messages. How to display only one validation message ?  </p>