message: create handleError method and chage listItem priva
diff: @@ -10,7 +10,7 @@ import { Subject } from 'rxjs';
  styleUrls: ['./list.component.css']
  })
  export class ListComponent implements OnInit {
  - listItems$: Subject<IListItem[]> = new Subject();
  + private listItems$: Subject<IListItem[]> = new Subject();
  warningMessageText = 'Request to get list items failed:';
  warningMessageOpen = false;
  @@ -23,30 +23,19 @@ export class ListComponent implements OnInit {
  loadItems(){
  this.listService.getListItems().subscribe(
  (listItem:IListItem[])=>{this.listItems$.next(listItem)},
  - error => {
  - this.warningMessageOpen = true;
  - this.warningMessageText = `Request to add list item failed: ${error}`;
  - }
  + error => this.handleError(`Request to get list items failed: ${error}`)
  );
  }
  addItem(inputText: string) {
  this.listService.addListItem(inputText).subscribe(
  - ()=>{this.loadItems()},
  - error => {
  - this.warningMessageOpen = true;
  - this.warningMessageText = `Request to add list item failed: ${error}`;
  - }
  + ()=> this.loadItems(), error => this.handleError(`Request to add item failed: ${error}`)
  );
  }
  deleteItem(id: number) {
  this.listService.deleteListItem(id).subscribe(
  - ()=>{this.loadItems()},
  - error => {
  - this.warningMessageOpen = true;
  - this.warningMessageText = `Request to delete list item failed: ${error}`;
  - }
  + () => this.loadItems(), error => this.handleError(`Request to delete item failed: ${error}`)
  );
  }
  @@ -54,4 +43,9 @@ export class ListComponent implements OnInit {
  this.warningMessageOpen = open;
  this.warningMessageText = '';
  }
  +
  + private handleError(warningMessageText:string) {
  + this.warningMessageOpen = true;
  + this.warningMessageText = warningMessageText;
  + }
  }
  