ionic3

How to read firebase push notification content and fire a method in ionic2?

本秂侑毒 提交于 2019-12-06 11:00:48
问题 Is it possible to access push notification content in ionic 2 and execute bunch of code when notification arrive or event fire ? 回答1: I'd recommend using the cordova-plugin-firebase instead. You can take a look at this repo to see how to use that plugin. Please notice that you'd need first to configure the firebase console, and donwload the .json / .plist files and add them to the root folder of your Ionic app. Then you can start using the plugin. In the demo everything is done in the app

Error to compile Ionic 3 with Cordova: cordova\node_modules\cordova-common\src\superspawn.js:169:23

陌路散爱 提交于 2019-12-06 10:50:49
问题 In Ionic 3 with Cordova when I give the command: ionic cordova run android --emulate It gives the following message: BUILD FAILED in 3s at ChildProcess.whenDone (C:\wellfitapp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:9040) UnhandledPromiseRejectionWarning:

Uncaught TypeError: Cannot set property 'length' of null at VirtualScroll.readUpdate

耗尽温柔 提交于 2019-12-06 09:53:14
I was using simple ion-list with ngFor to display items in a list in ionic 3 & was working fine. Then I used virtual scroll with ion-list & now I am getting following error: Uncaught TypeError: Cannot set property 'length' of null at VirtualScroll.readUpdate Code snippet: <ion-list [virtualScroll]="anArray" approxItemHeight="50px"> <div *virtualItem="let arrayItem"> //other code Array declaration: public anArray: any[]; In constructor: this.anArray = []; After network response: this.anArray = data.result; 来源: https://stackoverflow.com/questions/45750977/uncaught-typeerror-cannot-set-property

Correct way of defining a model in Ionic 3

一个人想着一个人 提交于 2019-12-06 09:37:16
What is the correct way of defining a model in Ionic 3 with getters and setters? I followed this. export class ItemModel{ private _name: string; constructor(private n: string){ this._name = n; } get name(): string { return this._name; } set name(name: string) { this._name = name; } } Is it correct? In some forums it was mentioned about a need to keep the code very short. So does that mean using getters and setters would affect the performance somehow? Typescript supports accessors natively , which effectively handle the job of getters and setters. You don't need to manually define them as

How can we use Provider in Pipe files while using Deep Linking and Lazy Loading Ionic 3?

南楼画角 提交于 2019-12-06 09:35:04
问题 I want to use a Provider, named as Translation.ts with a returnResult function in a Pipe named as TranslatePipe.ts . Translation.ts is @Injectable() export class TranslationProvider constructor() { } getResult(value) { returns something ; } } and TranslatePipe.ts is given as @Pipe({ name: 'translation', }) export class TranslationPipe implements PipeTransform { constructor(public translateService: TranslationProvider) { } transform(value: string, ...args) { return this.translateService

Input mask with thousand separator ionic 3

天大地大妈咪最大 提交于 2019-12-06 09:26:47
I need a thousand separator input mask directive or else with Ionic 3 app. I have tried 2 directives. But none of them were working. Do you know working directive for that? e.g. 50,000 .html <ion-input type="tel" [ngModel]="data?.budget" formControlName="budget" (ngModelChange)="data.budget=$event"></ion-input> I have logged issues on Git. please see that too: text-mask Issue ng2-currency-mask Issue Here is my version of formatting that works on ionic too. Typescript: format(valString) { if (!valString) { return ''; } let val = valString.toString(); const parts = this.unFormat(val).split(this

HTML + Ionic 3.x: How to use a for loop in the html file using in instead of of

♀尐吖头ヾ 提交于 2019-12-06 09:15:42
I have several arrays of objects in my typescript file. I want to iterate through these arrays simultaneously and display their contents in the html file. Here is the content: <ion-item> {{array1[i]}} {{array2[i]}} {{array3[i]}} </ion-item> Luckily the arrays are always the same size. Now I want to do a for-loop after the ion-item (something like this): <ion-item *ngFor="let i in array1"> {{array1[i]}} {{array2[i]}} {{array3[i]}} </ion-item> But doing it this way gives me an error: "Can't bind 'ngForIn' since it isn't a known property of 'ion-item'. Now I've found the following workaround, but

Ionic2, how to import custom plugin (appsee or uxcam) into Ionic App

牧云@^-^@ 提交于 2019-12-06 09:00:49
I am trying to use Appsee or UXcam I tried import like below, but no luck // import { Appsee } from '@ionic-native/appsee'; Else where i saw that you have to declare the variable in question for typescript to recognize the variable, I did that like below declare var cordova:any; // import { Appsee } from '@ionic-native/appsee'; declare var cordova:any; @Component({ templateUrl: 'app.html' }) export class MyApp { rootPage:any = LoginPage; // FOR TESTING constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { platform.ready().then(() => { cordova.plugins.Appsee.start(

Ionic 2 auth - Skip login page if there's an user on local storage

家住魔仙堡 提交于 2019-12-06 07:49:31
问题 I have an Ionic 2 application that does an authentication on my Rails 5 backend. Once the user is logged, I store his informations on local storage. So, once the user open the apps and he has already logged before, the login page should be skipped. I'm trying to do that on my app.component setting my root page depending on if there's information about the user on local storage or not, but the storage.get method appears to be asynchronous, so it is executing after my check, so it's always

How to handle fcm background notification without tapping on it in ionic 3

狂风中的少年 提交于 2019-12-06 07:28:52
i am using FCM in ionic 3. I am getting notification properly when the app is in foreground. When I receive a notification in background i am getting the data in the notification only after tapping the notification. But i want to get the data without tapping on the notification. For example see the below code. this.fcm.onNotification().subscribe(data => { if(data.wasTapped){ console.log("Received in background"); } else { console.log("Received in foreground"); }; }); Here i am getting data if data.wasTrapped is true else in the foreground. My problem is to get data without tapping the