import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {  Response } from '@angular/http';
import { AppService } from '../../service/appHttpService';

@IonicPage()
@Component({
  selector: 'page-announcementView',
  templateUrl: 'announcementView.html'
})

export class AnnouncementViewPage {

  notice: object;
  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    public appService: AppService
  ) {
    let id = this.navParams.get("id");
    this.getNoticeById(id);
  }

  //通过id获取通知公告详情
  getNoticeById(id) {
    this.appService.ObserverHttpPost("/wisdomgroup/modules/notice/getNoticeById", { id: id })
      .subscribe((res: Response) => {
        let data = res.json();
        console.log(data);
        this.notice = data;
      }, error => {
        this.appService.alert('网络异常！');
      }
      );
  }
}
