import { Component, OnInit } from '@angular/core';
import { WpdataService} from '../services/wpdata.service';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Component({
  selector: 'app-news',
  templateUrl: './news.page.html',
  styleUrls: ['./news.page.scss'],
})
export class NewsPage implements OnInit {

  newsdata: any = [];

  constructor(private wpgetdataService: WpdataService) { }

  ngOnInit() {

  }


  ionViewWillEnter() {
    this.wpgetdataService.getAllNews().subscribe((data) => {
      this.newsdata = data;
      console.log('load News Data');
      console.log(this.newsdata);
      });
  }

}
