import { Injectable, OnInit } from '@angular/core'; import { stringify } from 'querystring'; import { Tab1Page } from './tab1.page' import { Discoteca } from '../discoteca' import { Galeria } from '../galeria'; import { Evento } from '../evento'; @Injectable({ providedIn: 'root' }) export class Tab1Service implements OnInit{ discoteca: Discoteca; galeria: Galeria; eventos: Evento[]; constructor() { } ngOnInit(){ this.initValues(); } initValues(): void{ this.discoteca = new Discoteca(); this.discoteca.setNombre('Barraca'); this.discoteca.setTelefono(666666666); this.discoteca.setLocalizacion('Calle del Barquillo'); this.galeria = new Galeria(); this.galeria.setDiscoteca(this.discoteca.getNombre()); } getNombre(): string{ this.initValues(); return this.discoteca.getNombre(); } getTelefono(): number{ this.initValues(); return this.discoteca.getTelefono(); } getLocalizacion(): string{ this.initValues(); return this.discoteca.getLocalizacion(); } getEventos(): Evento[]{ return this.discoteca.getEventos(); } }