problem with injectable… I’m not sure if getdata() function is actually working.
far as the the line querying the database, it works but not sure if the variable “data” is receiving the data.
how do i determine if " return this.data" actually contains the data pulled from the database?
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {UserType} from '../usertype';
@Injectable()
export class LoginService {
public data:UserType[];
constructor(private http:Http){ }
getData():UserType[]{
this.http.get('http://localhost:8080/angular2/tutorial1/app/services/userlist.php')
.subscribe(res => this.data = res.json());
return this.data;
}
}