The Notifier service

Having the UI and the database in place, now it is time to implement the service that delivers the actual tasks for the notifier. Earlier in this chapter, we mentioned three tasks for the notifier: collect the news, rate and store them (in case they pass the threshold), and finally notify the user. The important feature for this service is that it should run periodically at specific times:

// src/app/notifier/notifier.service.ts import {Injectable} from '@angular/core'; import {CollectorService} from '../collector/collector.service'; import {RatingService} from '../rating/rating.service'; import {FirebaseListObservable, AngularFire} from 'angularfire2'; @Injectable() export class NotifierService { private cron = require('node-cron'); ...

Get Angular Services now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.