How can i insert page in ionic 3 segment layout

独自空忆成欢 提交于 2019-12-24 07:13:14

问题


This is my app with Tabs layout

Once i click on profile tab i push a page say Profile.ts which contains ion-segment in its own template Profile.html

Profile.html

<ion-content>
  <ion-segment [(ngModel)]="whichPage" color="primary">
  <ion-segment-button style="font-size: 11px" value="Personal">
    Personal
  </ion-segment-button>
</ion-segment>

<div [ngSwitch]="whichPage">
 <ion-list *ngSwitchCase="'Personal'">
 <ion-item>
   **HERE HOW CAN I DISPLAY ANOTHER PAGE WHICH I HAVE CREATED USING IONIC 
   GENERATE PAGE Personal**
 </ion-item>
</div>
</ion-content>

回答1:


You wont be able to display an entire page but you can set a component. This is because a particular page can only have one ion-content tag.

You will have to remove the header, footer and content parent tags from profile. You can have the profile content within Profile.html. and then use it within your segment as a Child component as:

<ion-list *ngSwitchCase="'Personal'">
 <ion-item>
   <PersonalComponent></PersonalComponent>
 </ion-item>
</ion-list>


来源:https://stackoverflow.com/questions/44630038/how-can-i-insert-page-in-ionic-3-segment-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!