Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//http://www.siraj360.com/ng2/ :: A single page application developed with Angular 2 (beta) and Bootstrap 4 (alpha).
import { Component } from 'angular2/core';
import { CORE_DIRECTIVES } from 'angular2/common';
import { EmployeeComponent } from '../employee/employee.component';
import { DataService } from '../../services/data.service';
@Component({
selector: 'employee-list',
directives: [CORE_DIRECTIVES, EmployeeComponent],
providers: [DataService],
templateUrl: 'app/components/employee/employeeList.component.html',
})
export class EmployeeListComponent {
employees: any[] = [];
courses: any[] = [];
employeeList: any[] = [];
constructor(private dataService: DataService) {
}
getData() {
this.dataService.getCourses()
.then((data_courses: any[]) => {
this.courses = data_courses;
});
this.dataService.getEmployeeList()
.then((data_employeelist: any[]) => {
this.employeeList = this.employees = data_employeelist;
});
}
ngOnInit() {
this.getData();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment