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;
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.