Delete multiple items from firebase list

I want to delete items in my firebase list,I am able to it by selecting single item…but if I create a checkbox and try to delete multiple items which are checked…I am not abe to delete them,

This is what I have tried…

<ion-header>
	<ion-navbar>
	    <ion-title>List files in firebase</ion-title>
	     <ion-buttons end>
      		<button ion-button clear (click)="openSharedFiles()">Shared Files</button>
    	</ion-buttons>
		 <ion-buttons end>
		<button ion-button clear primary (click)="deletem()">Delete</button>
		 </ion-buttons>
	 <ion-buttons end>
      <button ion-button (click)="selectClicked = !selectClicked" primary>Select</button>
    </ion-buttons>
	</ion-navbar>
</ion-header>
<ion-content padding>

	<ion-refresher (ionRefresh)="doRefresh($event)">
		<ion-refresher-content></ion-refresher-content>
	</ion-refresher>

	

	 <ion-list>
      <div *ngIf="selectClicked">
        <ion-item *ngFor="let file of files|async" (click)="showOptions(file.$key, file)">
          <ion-label *ngIf="selectClicked">{{ file.name }}</ion-label>
          <ion-checkbox [(ngModel)]="file.checked"></ion-checkbox>
        </ion-item>
      </div>
      <div *ngIf="!selectClicked">
        <ion-item *ngFor="let file of files|async" (click)="showOptions(file.$key, file)">
          <h2 *ngIf="!selectClicked">{{ file.name }}</h2>
          <h3 *ngIf="!selectClicked" ion-text color="primary">{{ file.modified|datepipe}}</h3>
        </ion-item>
      </div>
      
    </ion-list>

</ion-content>
	files: FirebaseListObservable<any>;

	this.userId = this.params.get('id');
	this.files = db.list('/'+this.userId+'/files');
	deletem(key){
		let confirm = this.alertCtrl.create({
			title: 'Delete file?',
			message: 'Do you want to delete?',
			buttons: [
			{
			  text: 'Cancel',
			  handler: () => {
			    console.log('Cancel clicked');		    
			                         }
			},
			{
			  text: 'Yes',
			  handler: () => {
			    console.log('Yes clicked');
					console.log(this.files);
					
		        let oldList = this.files;
                        let fileNames: Array<any> = [];
                        for(var i in oldList){
        	        if(oldList[i].checked == true){
        	        fileNames.push(oldList[i].name);
        	                                                    }
				                    }
                      let filesData = [];
                      for (let i in fileNames){ 
			    this.files.remove(fileNames[i].key);
			                                 }
			 
			                            	}
			}
			]
			});

		confirm.present();
	}

}

I am not getting any error here,but when I am clicking on delete button after selecting the files,no item gets deleted…

Please let me know where I am wrong…

Explain the logic behind this selectClicked please.

The intendation of your code is all over the place, making it very hard to read and understand. Could you fix this please?

the user can select multiple files,and if selectclicked,then that part of code will be executed like-
When the user clicks on select button on right side,following checkboxes appears-

and if !selectclicked,then the following is the output-

So not relevant for the problem at hand, right?
Did you test it without that additional logic and trim the problem down?