ionic-framework

My Hardware 'Back Button Action' is not working in Ionic 4

て烟熏妆下的殇ゞ 提交于 2020-05-25 15:57:18
问题 I am working in my Ionic 4 app and When the user clicks 2 times on the mobile back button, then it should close the app but this is not happening. This is my app.component.ts : lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>; constructor(){ this.backButtonEvent(); } backButtonEvent() { document.addEventListener("backbutton", () => { this.routerOutlets.forEach((outlet: IonRouterOutlet) => { if (outlet && outlet.canGoBack(

My Hardware 'Back Button Action' is not working in Ionic 4

两盒软妹~` 提交于 2020-05-25 15:53:54
问题 I am working in my Ionic 4 app and When the user clicks 2 times on the mobile back button, then it should close the app but this is not happening. This is my app.component.ts : lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>; constructor(){ this.backButtonEvent(); } backButtonEvent() { document.addEventListener("backbutton", () => { this.routerOutlets.forEach((outlet: IonRouterOutlet) => { if (outlet && outlet.canGoBack(

My Hardware 'Back Button Action' is not working in Ionic 4

淺唱寂寞╮ 提交于 2020-05-25 15:53:40
问题 I am working in my Ionic 4 app and When the user clicks 2 times on the mobile back button, then it should close the app but this is not happening. This is my app.component.ts : lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>; constructor(){ this.backButtonEvent(); } backButtonEvent() { document.addEventListener("backbutton", () => { this.routerOutlets.forEach((outlet: IonRouterOutlet) => { if (outlet && outlet.canGoBack(

Prevent reverse engineering of ionic application

半腔热情 提交于 2020-05-25 07:03:31
问题 Is there a way to prevent reverse engineering of ionic mobile application? As mentioned in Android forum I've activated proguard and built the application in eclipse. A file called proguard was created in my bin folder. It contained something like this view AndroidManifest.xml #generated:6 -keep class com.fg.lolc.CordovaApp { <init>(...); } But I still could reverse engineer the app and I was able to get the code from my APK. Is there a way to prevent this and improve the security of the

ionic 4 - how to create repeated form fields

旧时模样 提交于 2020-05-24 04:55:28
问题 I need to create a form to update multiple data items at the same time. It means repeating the same fields in a single form. My data is basically: this.formData = [ {areaId:1, price:10, qty:1000}, {areaId:2, price:10, qty:1000}, {areaId:3, price:10, qty:1000}, ... ] So I'm looping this data but I don't know how should I name those fields, cause they're repeating. <ng-container *ngFor="let a of this.formData; let i = index"> <div class="area" [attr.areaId]="a.id"> <ion-range min="1" max="10"

Angular 5 custom input pipe loses focus when deleting charcter

允我心安 提交于 2020-05-17 07:45:11
问题 I have an input in with a custom pipe that adds a space every 4 characters inserted. The issue is that if I insert for example "1234 5678" and I go and delete 4, the focus instead of staying there to insert a new character it moves to the end. PIPE import { Pipe, PipeTransform } from "@angular/core"; @Pipe({ name: 'formatBankAcc' }) export class FormatBankAccPipe implements PipeTransform { transform(value: string) { if (value != null) { value = value.replace(/[^\dA-Z]/g, '') .replace(/(.{4})

How to add border-radius to ion-img in Ionic 4

痴心易碎 提交于 2020-05-16 07:51:29
问题 I need to add border-radius to ion-img but it seems shadow DOM won't let me modify. HTML <ion-img [src]="img-url" [alt]="alt"></ion-img> CSS ion-img { border-radius: 10px !important; } 回答1: HTML <ion-img [src]="img-url" class="your-img"></ion-img> CSS .your-img { border-radius: 10px !important; overflow: hidden; } 回答2: It's tricky to encapsulate style with Shadow DOM, but there are ways. In this case, does it work for you with an inline style attribute? <ion-img [src]="img-url" [alt]="alt"

Payments to this merchant are not allowed (invalid clientId) - Ionic iOS

痴心易碎 提交于 2020-05-15 07:58:04
问题 Im using the paypal plugin for ionic and is not working on iOS I already have running this plugin on android and it is working perfect, and also have the clientid generated on https://developer.paypal.com/developer/applications/ doPayment() { const total: any = 10; const currency: any = 'USD'; const envProduct: any = ''; const envSandbox: any = '{Client ID from developer.paypal.com/developer/applications/}'; this.payPal.init({ PayPalEnvironmentProduction: envProduct, PayPalEnvironmentSandbox:

Error: “TypeError: Cannot read property 'seconds' of undefined” when trying to format a date field

不问归期 提交于 2020-05-14 03:48:20
问题 I'm trying to format a date field in my ionic project. THis date field is being read in from Firebase and I try to format it in the html page but I'm getting the following error: TypeError: Cannot read property 'seconds' of undefined The strange thing is that it displays as I would expect on screen but I'm not sure why the console error is displayed Attaching the .html, related .ts and .service.ts Here is the html code: (note that removing the format section I do not get the error) <ion-item>

How to show emoji in angular/ionic app

ぐ巨炮叔叔 提交于 2020-05-13 19:19:07
问题 In my mobile app using angular5/ionic3 app I want to show emoji icon. So I used something like <span>😁</span> But in rendering it will show it as empty square. I already have <meta charset="UTF-8"> in my index.html and html file is also saved as utf-8. I thought it could be related to sanitizing, so I created below pipe @Pipe({ name: 'safeHtml', }) export class SafeHtmlPipe implements PipeTransform { constructor(private domSanitizer: DomSanitizer) { } transform(html) { return this