Skip to content

Commit

Permalink
Step 2.18: Implement removeChat method
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and darkbasic committed Oct 16, 2017
1 parent 9acc010 commit 4a9cf27
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pages/chats/chats.ts
Expand Up @@ -67,4 +67,15 @@ export class ChatsPage {
}
]);
}

removeChat(chat: Chat): void {
this.chats = this.chats.map((chatsArray: Chat[]) => {
const chatIndex = chatsArray.indexOf(chat);
if (chatIndex !== -1) {
chatsArray.splice(chatIndex, 1);
}

return chatsArray;
});
}
}

0 comments on commit 4a9cf27

Please sign in to comment.