ionic4

How to dynamically go to previous page (ionic 4)?

为君一笑 提交于 2020-07-22 05:19:05
问题 Currently im migrating my ionic 3 project to ionic 5, in ionic 3 we use this.navCtrl.getPrevious().name; to get the previous page name by getting the previous page name i will navigate to different pages based on the previous page name can you please help me how can i get previous page name in ionic 4 回答1: Ionic 4+ moved away from navCtrl and leverages Angular Router. To read previous URL (route) you may do it via PreviousRouteService: import { Injectable } from '@angular/core'; import {

How to drag elements in Ionic 4/5

这一生的挚爱 提交于 2020-07-09 11:49:05
问题 I would like to create draggable (free) buttons in Ionic. In ionic 3 I used a directive to do this (link https://www.joshmorony.com/building-an-absolute-drag-directive-in-ionic-2/) but this directive don't works in ionic 5 and it does not give any errors. What do you think is the best library (supported from some tutorial) for ionic 5 to do this? Thanks in advance. 回答1: This does not have to be Ionic specific. If you are using angular you can just use an NPM component such as https://www

ion-button Click not firing up function in ionic 4

你说的曾经没有我的故事 提交于 2020-07-09 06:02:12
问题 I have a button and a function in my ionic 4 Code. Ideally on the click of the button, the function should fire up but that's not happening. MY HTML <ion-content padding> <div class="contentFlow" id="profile-content"> <h1>Profile</h1> <ion-button (click)="clicked()" expand="block" color="light"> Logout </ion-button> </div> </ion-content> MY TS: clicked() { alert('hello'); } Note: I need to keep the div in my code. What should I do? 回答1: I have seen such things when the rendering of elements

Ionic 4: Cordova is not available. Make sure to include cordova.js or run in a device/simulator

为君一笑 提交于 2020-07-05 04:56:50
问题 I am trying to use the cordova plugin in a new ionic 4 project but I always run into errors regarding cordova. The plugin is properly installed and shows up in the plugin folder. Error Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator home.page.html <ion-header> <ion-toolbar> <ion-title> Ionic Blank </ion-title> </ion-toolbar> </ion-header> <ion-content> <ion-button expand="full" (click)="openLocalPdf()">Open

Capture and upload image to server using Ionic 4

∥☆過路亽.° 提交于 2020-06-26 12:59:09
问题 I've been trying to capture an image and upload it to the server for days but no luck. I'm using Ionic 4 for my client side, and Java as my backend (I used Jersey to expose my backend to REST). Now, the problem is that after taking the image, and try to upload it I keep recieving a null in my backend. Here is my client side code : openCam(){ const options: CameraOptions = { quality: 100, destinationType: this.camera.DestinationType.FILE_URI, encodingType: this.camera.EncodingType.JPEG,

Webpack chunks are unable to load on Android. Web and iOS are fine ( ChunkLoadError: Loading chunk pages-home-home-module failed.)

杀马特。学长 韩版系。学妹 提交于 2020-06-26 07:36:53
问题 I have an ionic 4 capacitor app that is working properly on iOS. I am using Angular 8 with lazyloading. However, whenever I want to run the android app, I get a significant amount of errors saying that many chunks failed to load. I do not get any error doing ionic build --prod Here are the error messages: E/Capacitor/Console: File: http://localhost/polyfills-es2015.92885f6bd7b81e5291ae.js - Line 1 - Msg: Unhandled Promise rejection: Cannot read property 'isProxied' of undefined ; Zone: <root>

Webpack chunks are unable to load on Android. Web and iOS are fine ( ChunkLoadError: Loading chunk pages-home-home-module failed.)

流过昼夜 提交于 2020-06-26 07:36:21
问题 I have an ionic 4 capacitor app that is working properly on iOS. I am using Angular 8 with lazyloading. However, whenever I want to run the android app, I get a significant amount of errors saying that many chunks failed to load. I do not get any error doing ionic build --prod Here are the error messages: E/Capacitor/Console: File: http://localhost/polyfills-es2015.92885f6bd7b81e5291ae.js - Line 1 - Msg: Unhandled Promise rejection: Cannot read property 'isProxied' of undefined ; Zone: <root>

Hide Splash Screen in Ionic Capacitor React

限于喜欢 提交于 2020-06-26 07:22:37
问题 How can we disable the splash screen on an Ionic App? I am using Ionic 4, Capacitor and React. I have tried to add this on capacitor.config.json { "plugins": { "SplashScreen": { "launchShowDuration": 0 } } } The above code is not working at all. 回答1: You can hide the splash screen using the SplashScreen plugin : import { Plugins } from '@capacitor/core'; const { SplashScreen } = Plugins; function useSplashHide(){ useEffect(() => { SplashScreen.hide(); }, []); } Documentation is here 回答2: You

Hide Splash Screen in Ionic Capacitor React

我们两清 提交于 2020-06-26 07:22:25
问题 How can we disable the splash screen on an Ionic App? I am using Ionic 4, Capacitor and React. I have tried to add this on capacitor.config.json { "plugins": { "SplashScreen": { "launchShowDuration": 0 } } } The above code is not working at all. 回答1: You can hide the splash screen using the SplashScreen plugin : import { Plugins } from '@capacitor/core'; const { SplashScreen } = Plugins; function useSplashHide(){ useEffect(() => { SplashScreen.hide(); }, []); } Documentation is here 回答2: You

How to change the color of custom svg icon in ionic 4?

天大地大妈咪最大 提交于 2020-06-26 03:12:37
问题 I want to change the color of a custom svg icon on clicking a button <ion-item> <ion-icon src="../../assets/img/icon-qr.svg"></ion-icon> <ion-label>Qr Scan</ion-label> </ion-item> 回答1: I was unable to override an svg stroke or fill if it was specified in the svg. Example: bad svg <svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"> <g fill="#88AACC" fill-rule="evenodd" stroke-linecap="round" stroke="#555555" stroke-linejoin="round" stroke-width="2"> ... </g> <