在我的情况下,我有一个离子页面显示不同模板中的选定项目。对于每个项目类型我有设置对象,可以使用ngOnint从服务器获取选择项目后,我渲染HTML取决于这些设置。例如我使用* ngIf显示/隐藏某个组件。如何在Ionic 2/3中呈现html页面之前从url promise加载数据?
问题出在html文件中,设置对象是未定义的。
如何在呈现html之前获取设置对象。 说明:我正在使用servlet的web服务。
Açıklama
Fiyatlar
Konum
Yorumlar
TS文件
constructor(public navCtrl: NavController,
public navParams: NavParams, private postApi: PostAPI,
public loadingCtrl: LoadingController, public alerCtrl: AlertController) {
this.loading = this.loadingCtrl.create();
this.post = navParams.get('post');
}
ngOnInit() {
this.postApi.GetPostTypeSetting(this.post.PostTypeId).then(res => {
this.settings = res;
console.log(res);
});
this.postApi.GetPostDetail(this.post.PostId).then(res => {
this.postDetail = res;
console.log(res);
});
this.postApi.GetCategoryDetail(1, 1).then(res2 => {
});
}