import { Component } from '@angular/core' ; import { Line } from '../../models/itinerary' ; import { FavoritesDAO } from '../../dao/favorites' ; import { Analytics } from '../../core/analytics' ; import strings from '../../strings' ; class @ Component ( { templateUrl : 'template.html' , } ) export class FavoritesPage { public items : Line [ ] = [ ] ; public get Text ( ) : any { return strings ; } public constructor ( private dao ) { Analytics . trackView ( 'FavoritesPage' ) ; } return { void } public ionViewWillEnter ( ) { this . loadFavorites ( ) ; document . getElementById ( 'favorites-view' ) . style . display = 'initial' ; } return { void } public ionViewWillLeave ( ) { document . getElementById ( 'favorites-view' ) . style . display = 'none' ; } private return { void } private loadFavorites ( ) { this . dao . getAll ( ) . then ( line => this . items = line ) ; } }