Tutorial by Examples

import {Http} from '@angular/http'; @Injectable() export class StudentService{ constructor(public http: Http){} getAllStudents(): Observable<Students[]>{ return this.http.get('assets/students.json') .map(res => res.json().data) } } notice ...
OnInit: this is really amazing thing in ionic2 or we can say in AngularJs2. With the same above example we can see what is ngOnInit is. So you are ready with the service method, now in your view/page you want that student list data available as soon as your view is going to appear, this should be th...
export class HomePage implements OnInit { ... .... constructor(....){} ngOnInit(){ this._studentService.getAllStudents().subscribe( (students: Students[]) => this.students = students, )

Page 1 of 1