import { Component,OnInit } from '@angular/core'; import { Http } from '@angular/http'; import { FileUpload ,HtmlPost,News} from './../../app.class'; @Component({ moduleId: module.id, selector: 'news-list', templateUrl: './news.component.html' }) export class NewsComponent implements OnInit { new:News=new News(); news:any; constructor(public http:Http){this.http=http}; ngOnInit(){ this.new.list(this.http,res=>this.news=res); } deleteNews(id:string){ this.new.delete(id,this.http,res=>{ this.new.list(this.http,res=>this.news=res); alert(res.message); }); } }