我通过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