ionic2

Import two exported classes with the same name

安稳与你 提交于 2020-02-17 17:56:06
问题 In typescript, using Angular 2, I need to import two classes with the same name, but lying in different paths. The project is quite too big that I find it hard to change the exported class names. Is there any way to alias the imported classes, import {Class1} from '../location1/class1' import {Class1} from '../location2/class1' 回答1: You can use as like this: import {Class1} from '../location1/class1' import {Class1 as Alias} from '../location2/class1' You can find more about the ES6 import

How to get selected date from ionic-2 calendar onchange() method

微笑、不失礼 提交于 2020-02-06 07:30:47
问题 I am using ion2-calendar. this is my html: <ion-calendar [(ngModel)]="date" (onChange)="onChange($event)" [type]="type" [format]="'YYYY-MM-DD'"> </ion-calendar> and this is onchange in ts: onChange($event) { console.log("onchange event called"); console.log(moment().format('DD-MM-YYYY')); } This is my console: onSelect event called 25-06-2018 But i am always getting current month and year,no matter which date I choose. Only the date value is changing. Its showing current month and year in the

Multiple $http requests in Ionic2

我只是一个虾纸丫 提交于 2020-02-05 05:14:47
问题 I want to know whether the Multiple request : if my $http request 1 start , let's say $http request 1 ends and tried to call $http request 2 . my question how can i create a multiple request ? for example : call $http request 1 then $http request 2 . 回答1: As I understand, you're trying to make more than one http request and then process the response when all those request have ended. For instance, you may need to load data from more than one source, and delay the post-loading logic until all

How to get selected only single checkbox from multiple checkboxes using ionic 2 and angular2

对着背影说爱祢 提交于 2020-02-05 03:24:24
问题 Presently working on ionic2 and angular2 I am having fields of 7 checkboxes. I need to select only one particular checkbox the remaining checkboxes should be disabled.Similarly, I need to get for remaining 6 checkboxes also. How can I do that, Here is the code I have used in my HTML // payment.HTML <ion-card class="ion-card"> <ion-item> <ion-label>Cash On Delivery</ion-label> <ion-checkbox item-right checked="true" [(ngModel)]="checked"></ion-checkbox> </ion-item> <ion-item no-lines> <ion

Chart.js Ionic 2 Angular2: Background color of bar graph not changing

守給你的承諾、 提交于 2020-02-04 01:41:25
问题 I'm using Chart.js to create a stacked bar graph for a hybrid app using Ionic2 and Angular2. I cannot get the background color or fill color of the bars in the graph to change. I've used every configuration/example that is given on chart.js documentation, and I always get the default red and blue default(?) colors. Here is what I have: barChartOptions:any = { responsive: true, scales: { xAxes: [{ categoryPercentage: 0.6, barPercentage: 1.0, stacked: true, ticks: { beginAtZero: true },

ionic 2 not updating the Counter property in html

有些话、适合烂在心里 提交于 2020-02-04 01:29:05
问题 I have this simple example which does update the Counter value in my HomePage class. But in the html view: <p>{{Counter}}</p> this remains zero. The method: ondrag(event, item) { let percent = event.getSlidingPercent(); if (percent === 1) { event.close(); this.Counter--; } if (percent + 1 === 0) { event.close(); this.Counter++; } } works on my machine if i add logs for each if Here is the code on plnkr: https://plnkr.co/edit/7Q4wDtZjIS1zBDsF0etS Any suggestions? 回答1: This topic was already

Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined

陌路散爱 提交于 2020-01-30 08:05:41
问题 Ionic 2 failed CLI build giving me the following error: "TypeError: Cannot read property 'AssetUrl' of undefined". My research lead me to this thread and this one. Both threads suggest to modify the "package.json" file and to remove the "^" sign in front of the version in "dependencies" and "devDependencies". I did that and then CLI: ionic rm platform android ionic add platform android and finally: ionic build android I still get the same error. At some point in this thread , it suggests

Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined

耗尽温柔 提交于 2020-01-30 08:04:21
问题 Ionic 2 failed CLI build giving me the following error: "TypeError: Cannot read property 'AssetUrl' of undefined". My research lead me to this thread and this one. Both threads suggest to modify the "package.json" file and to remove the "^" sign in front of the version in "dependencies" and "devDependencies". I did that and then CLI: ionic rm platform android ionic add platform android and finally: ionic build android I still get the same error. At some point in this thread , it suggests

npm run ionic:build --prod giving strange error

左心房为你撑大大i 提交于 2020-01-30 05:59:45
问题 When I am trying to run npm run ionic:build --prod , it is giving me below errors: Error: Cannot determine the module for class OverlayPortal in F:/D/IONIC/quicktask/quicktask-web-froala/node_modules/ionic-angular/umd/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it. Cannot determine the module for class IonicApp in F:/D/IONIC/quicktask/quicktask-web-froala/node_modules/ionic-angular/umd/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.

How to get IMEI in ionic2 on an android device

吃可爱长大的小学妹 提交于 2020-01-29 20:26:18
问题 I am trying to obtain the imei of an android device in ionic 2, but so far no luck. In ionic 1 l just used an ngCordova plugin like cordova-uid https://github.com/hygieiasoft/cordova-plugin-uid. Is there a plugin for ionic-native that I can use to obtain the imei or is there any other way to get the imei. 回答1: Can use this code. cordova plugin add org.hygieiasoft.cordova.uid Or cordova plugin add https://github.com/hygieiasoft/cordova-plugin-uid For test use console.log declare var cordova: