Skip to content

Instantly share code, notes, and snippets.

@SirajGadhia
Created January 30, 2016 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirajGadhia/0023e3802a88e12c4568 to your computer and use it in GitHub Desktop.
Save SirajGadhia/0023e3802a88e12c4568 to your computer and use it in GitHub Desktop.
//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