import { Component } from '@angular/core' ; import { UploadMetadata } from 'angular2-image-upload' ; @ Component ( { selector : 'filter' , templateUrl : './filter.component.html' } ) export class FilterExampleComponent { private fileCounter = 0 ; onBeforeUpload = ( metadata ) => { if ( this . fileCounter % 2 === 0 ) { metadata . abort = true ; } else { metadata . url = 'http://somewhereelse.com' ; } this . fileCounter ++ ; return metadata ; } ; }