import { Component, OnInit } from '@angular/core'; import { Http } from '@angular/http'; import { Active } from './../../app.class'; @Component({ moduleId: module.id, selector: 'active-page', templateUrl: './active.component.html' }) export class ActiveComponent implements OnInit { actives: any[]; constructor(public http: Http) { } ngOnInit() { let active = new Active(this.http); active.list(res => this.actives = res); } deleteActive(id: string) { let active = new Active(this.http); active.delete(id, res => { active.list(res => this.actives = res);alert(res.message); }); } }