I have an array and I need to display several random items from this array. Now the code looks like this, but I think that there simply should be two different services, one in another. my component looks like this:
  items: Item[];
  randomItems: Item[];
  ngOnInit() {
    this.someService.getItems().subscribe((items) => {
      this.items = items;
    });
    this.randomIndex(this.items);
  }
  randomItems(items: Item[]) {
    return this.randomItems = _.sample(items, _.random(9));
  }
}
interface Items {
  id: number,
  title: string,
  body: string
}
my html looks like this:
 <ul *ngFor="let item of items">
     <li>{{ item.id }}</li>
 </ul>
How can I make two different services from this code?
 
     
    