I need to set json data from one to another function.
But i can't. Is there any mistaken in my code.
ngOnInit() {
this.getNames();
}
getNames() {
this.http.get('app/mock/names.json')
.map((res:Response) => res.json())
.subscribe(
data => this.filter(data),
err => console.error(err),
() => console.log('done')
);
}
filter(data) {
if (this.query !== ""){
console.log(data);
}
}
I got only undefined message. Anyone plz help me
--
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.