import { Component , OnInit } from '@angular/core' ; import { Notification } from '../../models/notification' ; import { NotificationsService } from '../../services/notifications.service' ; import { LoggerService } from '../../services/logger.service' ; @ Component ( { selector : '.notificationsBox' , styleUrls : [ './notification-box.component.css' ] , templateUrl : './notification-box.component.html' } ) export class NotificationBoxComponent implements OnInit { public notifications : Notification [ ] ; notifLength = { 0 : 0 } ; constructor ( private notifServ , private logger ) { this . notifications = [ ] ; } public ngOnInit ( ) { this . notifServ . notifications . subscribe ( ( notif ) => { this . logger . log ( 'NotificationBox' , null , 'RECEIVED.NOTIFICATION' , null ) ; this . notifications = notif ; this . notifLength = { 0 : this . notifications . length } ; } ) ; } }