import { Component, OnInit } from '@angular/core'; import { MallService, Mall } from '../services/mall.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-malls', templateUrl: './malls.page.html', styleUrls: ['./malls.page.scss'], }) export class MallsPage implements OnInit { selected_tab: string = 'you'; malls: Array; constructor( private mallService: MallService, private router: Router ) { } ngOnInit() { } ionViewDidEnter() { this.mallService.getAllMalls().then((data: Array) => { this.malls = data; }); } showMallDetails(mall) { this.router.navigate(['/mall-details', { mall_id: mall.id }]); } }