Open mamarilmanson opened 8 years ago
Hi... I tried this example... used it in my app... modified it to look like this:
import { Page } from 'ionic-angular'; import { Http, Headers } from 'angular2/http'; import 'rxjs/add/operator/map'; @Page({ templateUrl: 'build/pages/home/home.html', }) export class WeekViewPage { /** * inject the HTTP service into the component */ constructor(private http: Http, private randomUser) { // CHANGES HERE this.http = http; this.getRandomUser() } /** * gets user using random.me api */ getRandomUser() { this.http.get('https://randomuser.me/api/') .map(res => res.json()) // convert json .subscribe( data => this.randomUser = data.results[0].user, err => console.log('Random User', err) ); } }
But it presented an error in my console:
apologies for late response, did you get this resolved?
thanks for answering...
yes... mine is working now... :)
Hi... I tried this example... used it in my app... modified it to look like this:
But it presented an error in my console: