ionic2

TypeError: Cannot read property 'content' of undefined

青春壹個敷衍的年華 提交于 2021-02-08 07:56:39
问题 I have a config file throwing error when only building with AOT ionic cordova build android --prod Error: ./src/config/.env.ts Module build failed: TypeError: Cannot read property 'content' of undefined at Object.optimizationLoader (/Users/yasir/myApp/mobile/node_modules/@ionic/app-scripts/dist/webpack/optimization-loader-impl.js:14:24) at Object.loader (/Users/yasir/myApp/mobile/node_modules/@ionic/app-scripts/dist/webpack/optimization-loader.js:5:32) @ ./src/providers/post-service.js 15:0

Sort an array with integers and letters alphabetic in Angular / Typescript

回眸只為那壹抹淺笑 提交于 2021-02-08 03:42:26
问题 What I plan to do I try to sort an array like this... 1 2 2(a) 2(b) 2(b) #AsimpleName 2(b) #NameWithN 3 4 4(a) ... ... in Angular2. My Current Code Component this.streetDetailRef = this.afDatabase.list('data/users/' + this.currentUserID + '/territory/' + this.sStreet.parentKey + '/' + this.sStreet.key + '/houseNumbers/'); this.streetDetailData = this.streetDetailRef.snapshotChanges().map(changes => { return changes.map(c => ({ key: c.payload.key, ...c.payload.val() })).sort(); }); The loop in

how to make ion-grid clickable like button in Ionic 2

*爱你&永不变心* 提交于 2021-02-07 20:36:17
问题 I designed table by using "ion-grid" but my problem in case to make it clickable like button. I could only call function by using (click)="functionX(). for example this is my grid, <ion-grid style="padding:0px;" (click)="function1()"> <ion-row> <ion-col col-6> Text1<br>Text1<br>Text1 </ion-col> <ion-col col-6> Text2<br>Text2<br>Text2 </ion-col> </ion-row> </ion-grid> <ion-grid style="padding:0px;" (click)="function2()"> <ion-row> <ion-col col-6> Text3<br>Text3<br>Text3 </ion-col> <ion-col col

fcm.onNotification() not getting called on clicking the notification when the app is in background

£可爱£侵袭症+ 提交于 2021-02-07 18:15:56
问题 I have installed cordova-plugin-fcm and everything works fine except one little thing. When the app is in background/closed and push notification is sent from firebase, notification pops up in the devices. On clicking that notification from the tray my application starts run, but the control is not entering into fcm.onNotification(). My code in app.component.ts looks like this fcm.onNotification().subscribe(data=>{ if(data.wasTapped){ console.log("Received in background"); console.log(data);

fcm.onNotification() not getting called on clicking the notification when the app is in background

左心房为你撑大大i 提交于 2021-02-07 18:14:31
问题 I have installed cordova-plugin-fcm and everything works fine except one little thing. When the app is in background/closed and push notification is sent from firebase, notification pops up in the devices. On clicking that notification from the tray my application starts run, but the control is not entering into fcm.onNotification(). My code in app.component.ts looks like this fcm.onNotification().subscribe(data=>{ if(data.wasTapped){ console.log("Received in background"); console.log(data);

Transpile errors with cordova-plugin-file-transfer

≯℡__Kan透↙ 提交于 2021-02-07 09:20:25
问题 I want to use the cordova file transfer plugin. I'm using it through the Ionic-Native transfer module. The app won't run because there is a transpile error with the file transfer plugin and the file plugin: transpile started ... typescript: plugins/cordova-plugin-file-transfer/types/index.d.ts, line: 9 Cannot find type definition file for 'cordova-plugin-file'. L8: * @param server URL of the server to receive the file, as encoded by encodeURI(). L9: * @param successCallback A callback that is

Display a Loading icon while images loads

笑着哭i 提交于 2021-02-04 10:58:29
问题 I want to show a background image/loading spinner inside a div that will load an image inside of it, the image will show once it's fully loaded doing something like this: <div style="background-image:url('imageThatWillAppearBeforeLoad')"></div> Demo (In jQuery) How can I have the same using Angular2/Ionic2? 回答1: Create a component that shows the placeholder image until the requested image is loaded, and hides the requested image. Once the image is loaded, you hide the placeholder and show the

Automatically open the datetime component from an ion-select modal in Ionic2?

时光怂恿深爱的人放手 提交于 2021-01-28 09:56:33
问题 In Ionic 2 is there a way to automatically open the datetime component after an event like pressing the OK button in an ion-select modal? So it will go directly from pressing ok to selecting/pulling up a time on the datetime component. I have yet to find a solution to directly do this. 回答1: Here we go on your template: <ion-datetime #dateTime style="display:none" displayFormat="h:mm A" pickerFormat="h mm A" [(ngModel)]="startTime"></ion-datetime> <button (click)="openStart()"></button> and

Automatically open the datetime component from an ion-select modal in Ionic2?

有些话、适合烂在心里 提交于 2021-01-28 09:55:12
问题 In Ionic 2 is there a way to automatically open the datetime component after an event like pressing the OK button in an ion-select modal? So it will go directly from pressing ok to selecting/pulling up a time on the datetime component. I have yet to find a solution to directly do this. 回答1: Here we go on your template: <ion-datetime #dateTime style="display:none" displayFormat="h:mm A" pickerFormat="h mm A" [(ngModel)]="startTime"></ion-datetime> <button (click)="openStart()"></button> and

How to use ngModel in ion-checkbox?

允我心安 提交于 2021-01-27 07:18:56
问题 I'm trying to use with ngModel, but ngModel doesn't work there. My code: <ion-checkbox *ngFor="#item of items" [(ngModel)]="item.checked"> {{item.name}} </ion-checkbox> But I get an error: EXCEPTION: Expression 'checked in AddInterestItem@5:2' has changed after it was checked. Previous value: 'false'. Current value: 'false' in [checked in AddInterestItem@5:2] example data: this.items = [ {name: 'Dancing', checked: false}, {name: 'Jazz', checked: false}, {name: 'Metal', checked: true}, {name: