Raising and consuming Domain Events

When a user clicks on a particular board in the board-list component, we can trap this event by adding a click handler in our board-list.component.html file as follows:

<div *ngFor="let board of boardList;"  
   class="col-sm-4 board-detail-clickable"  
   (click)="buttonClickedDetail(board)"> 

Here, we have added a (click) event handler on the outer <div> element that is generated for each of the boards in our board list. The click handler is named buttonClickedDetail, and has a single argument that is set to the current array element of the boardList array. The corresponding function in our board-list.component.ts file is as follows:

... existing imports ... import { BroadcastService } from '../services/broadcast.service'; ...

Get Mastering TypeScript 3 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.