ionic4

Ionic 4 Angular router navigate and clear stack/history of previous page

扶醉桌前 提交于 2020-01-05 15:25:13
问题 I'm developing an app using Ionic 4 with Angular router. I would like to navigate to another page and clear the page stack. In Android native, it's something like this: Intent intent = new Intent(NewActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); From what I've read so far, it is possible using Ionic NavController but it is deprecating in Ionic 4. I learnt about buttons with routerLink but if I'm not mistaken, by using that the app

Ionic 4 How to get data from another page

谁说我不能喝 提交于 2020-01-04 11:10:51
问题 I'm navigating page and send data to page. i want to know how can i get data i send to the page ? . Example: In ionic 3 we push page and send data like this this.navCtrl.push(Page, {x:x}) And in other page we get date from navParams like this.navParams.get('x'); I need to know how ill get data in ionic 4 ? Im navigating page and data like this details(y){ this.navCtrl.navigateForward('/packagedetails',{y:y}); } 回答1: You can use navigaionExtras to achieve this page1: let navigationExtras:

How to detect platform using Ionic 4

廉价感情. 提交于 2020-01-04 09:48:09
问题 How to detect browser and mobileweb platform using Ionic 4 because when I tried with below code in desktop browser it is not falling in ‘core’ condition. if (this.platform.is('core')) { alert('core platform'); } else { alert('something else'); } When I have debug in chrome developer tool it showing 'android' platform as per below snapshot. Can anyone please help me how to detect platform in Ionic 4 or what can be the alternative for this? 回答1: The following link may help you: https://forum

Is there a way to make ion-segment look the same on both iOS and Android?

帅比萌擦擦* 提交于 2020-01-03 19:31:28
问题 After setting the mode of ion-segment, they still look different after rendering them in ionic lab. I have tried setting the mode of ion-segment and ion-toolbar to "md" but they still look different. https://ibb.co/HV75Ly2 Here is an image of what they look like after setting the mode. <ion-toolbar mode="md"> <ion-segment scrollable mode="md"> <ion-segment-button value="top" checked> TOP </ion-segment-button> <ion-segment-button value="nfl"> NFL </ion-segment-button> <ion-segment-button value

Is there a way to make ion-segment look the same on both iOS and Android?

不打扰是莪最后的温柔 提交于 2020-01-03 19:31:11
问题 After setting the mode of ion-segment, they still look different after rendering them in ionic lab. I have tried setting the mode of ion-segment and ion-toolbar to "md" but they still look different. https://ibb.co/HV75Ly2 Here is an image of what they look like after setting the mode. <ion-toolbar mode="md"> <ion-segment scrollable mode="md"> <ion-segment-button value="top" checked> TOP </ion-segment-button> <ion-segment-button value="nfl"> NFL </ion-segment-button> <ion-segment-button value

Instagram-like force touch popup modal

柔情痞子 提交于 2020-01-03 07:24:07
问题 I'm trying to replicate force touch functionality of Instagram where 1) Put your finger on an image and it gets a little darker (hover effect, easy) 2) Press a little harder and a popup modal preview of the content appears 3) Press even harder and it expands the modal to full screen I'm having problems with Ionic 4/Cordova "3d touch" plugin where it doesn't register the force-touch if I regular-touch the screen first. In order words, step 2 above does not trigger the force touch when

Ionic 4 ion-slides change css style of the active slide using ngClass

三世轮回 提交于 2020-01-03 02:24:13
问题 EDIT: adding a stackblitz: https://stackblitz.com/edit/ionic-b2r7si I am using ion-slides as following: <ion-slides class="fullWidth" [options]="slideOptsOne" #slideWithNav (ionSlideDidChange)="change($event)"> <ion-slide #status *ngFor="let array of arrays"> <ion-col> {{array}} </ion-col> </ion-slide> </ion-slides> I need to change the css style of the current active slide, like make it underlined or bold. I've done some researches and apparently I should use [ngClass]='' but can't know how.

Http.get() working but not working in build(Release/Debug) in Ionic 4

丶灬走出姿态 提交于 2020-01-02 19:22:09
问题 I am trying get data from a simple api, it works fine in ionic serve (browser) , But when i build the app http call does not work. my Code is this.http.get("http://example.com/api/routes").subscribe(response => { this.routes = response["routes"]; for (let x in this.routes) { let a = this.routes[x].rou_stops; let b = a.split(","); for (let y in b) { this.newCit.push(b[y]); } } }); please help with this issue. 回答1: I am Guessing that your are getting this because of android changes its http

Ionic 4 (Angular 7) - sharing components issue

天大地大妈咪最大 提交于 2020-01-02 06:31:00
问题 I'm trying to do an extremely usual thing for such a framework like Angular. The goal is to use the same ( HeaderComponent ) component more than once through a shared module. My shared.module.ts: import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { HeaderComponent } from '../header/header.component'; import { IonicModule} from '@ionic/angular'; @NgModule({ imports: [ CommonModule, IonicModule ], declarations: [ HeaderComponent ], exports: [

Ionic 4 - Angular 6: How to control Ionic router history to stop cache a view component?

放肆的年华 提交于 2020-01-02 02:31:08
问题 Maybe I am missing something, but I'm experiencing a problem with Ionic caching views previously visited, preventing the components from being re-initialized by Angular. The components are pulled from some cache and rendered as whatever data existed previously. Example : User A is logged into the application and starts on the 'Home' page with info relevant to user A. User A logs out and navigates to 'Log In'. User B logs in from the same application and navigates to 'Home' page. Ionic see's