Now that we have all players in place, it is time to update our component to glue everything together. Open the component file and update it as follows:
// src/app/rating/rating.component.ts import {Component} from '@angular/core'; import {RatingLogic} from './rating.logic'; import {RatingService} from './rating.service'; @Component({ selector: 'sh-rating', templateUrl: './rating.html', providers: [RatingLogic, RatingService] }) export class RatingComponent { private ratingService; private trends; private collectedNews; private ratedNews; constructor(rs:RatingService) { this.ratingService = rs; this.trends = rs.getTrends(); this.collectedNews = rs.getNews(); this.ratedNews= rs.rateNews(); } }
Tip
Notice that we have specified two providers in the meta data section of the component: the rating logic and service.
All the heavy lifting has been done inside the previous two classes already. That's why this component...