我通過http獲取數據。我想將數據傳遞給PlacesListPage。在我的數據中有「ID,名稱,類別......」。我想在PlacesListPage使用theese這樣的:{{} xxx.id},{{xxx.name}} ...請幫我... XXX - 例如)如何通過ionic2傳遞數據
import {Page, NavController, NavParams} from 'ionic-angular';
import {Http} from 'angular2/http';
import 'rxjs/Rx';
import {PlacesListPage} from '../places-list/places-list';
/*enter code here
Generated class for the PlacesPage page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Page({
templateUrl: 'build/pages/places/places.html',
})
export class PlacesPage {
static get parameters() {
return [[NavController], [Http], [NavParams]];
}
constructor(nav, http, navParams) {
this.nav = nav;
this.http = http.get('https://api.myjson.com/bins/2ud24').map(res => res.json()).subscribe(
(data) => {
this.data = data;
});
}
什麼是'PlacesListPage'?這是一項服務嗎?它是一個自定義元素嗎?你在'places.html'裏面使用它嗎? – kabaehr
是的。這是自定義頁面。我進口頂部。第4行 –
你能提供它的代碼嗎? – kabaehr