ionic-framework

Faking a module in angular 2 test

廉价感情. 提交于 2019-12-24 11:29:21
问题 I have a function in angular 2 service which I would like to test. service.ts upload(){ let file = new Transfer(); file.upload(myfile).then( // my callback ); } I would like to mock Transfer in my test using jasmine . I tried this in my sevice.spec.ts import { TransferMock as Transfer } from '../mocks/mocks' to mock it. But it is not working. This is how my test is instantiated . describe('authentication service' , () => { beforeEach(() => { auth = new Service(<any>new HttpMock(), <any>new

My Wishlisted product is not showing Wishlisted for the login user in Ionic

放肆的年华 提交于 2019-12-24 11:23:22
问题 I am working on the Ionic Ecommerce App and It has a Wishlist button for all the products. The user can only wishlist the product after login and if the user is not login it will the user a popup message. But the problem is that when the user wishlist the product by clicking on the heart and again the user will come on the product page and wishlist product is not showing the product wish-listed. This is my productdetails.html : <ion-col *ngFor="let product of this.pdeta" col-5 class=

Ionic App on Android not sending http requests

我怕爱的太早我们不能终老 提交于 2019-12-24 11:20:43
问题 I need your help. I have an app in the app store which is based on ionic and build with phonegap build. Since last week some of my users cannot login into to the app anymore. I already tried to debug on the server side but the request does not even reach the server. The weird thing is that the problem started to appear last week before that everything worked fine. It seems to occur only on some phones, but I cannot see a pattern of smartphone type or android version. I already read most of

fetching data from json file in assets folder

醉酒当歌 提交于 2019-12-24 11:06:06
问题 Trying to fetch data from a json file in ionic 2 application, I am using the below piece of code within constructor for fetching json from assets folder, but getting error " Supplied parameters do not match any signature of call target ." What i am missing, Please suggest. this.http.get('assets/sample.json') .map((res) => res.json().records) .subscribe(data => { this.data = data; console.log("json data"+ data); }, (rej) => {console.error("Could not load local data",rej)}); 回答1: So I solved it

More than one library with package name 'com.google.android.gms.license'

微笑、不失礼 提交于 2019-12-24 10:55:56
问题 I'm using angular 4 and ionic 3. Now when i run "ionic cordova run android" It gives me the following error: "more than one library with package name 'com.google.android.gms.license'" My project.property file: target=android-26 android.library.reference.1=CordovaLib cordova.system.library.1=com.android.support:support-v4:27.1.0 cordova.system.library.2=com.android.support:support-v4:27.1.0 cordova.system.library.3=com.android.support:support-v4:27.1.0 cordova.system.library.4=com.android

How to resolve: Cannot determine the module for class OverlayPortal

*爱你&永不变心* 提交于 2019-12-24 10:47:04
问题 I'm facing following issue: If I try to build my Ionic 3 app for ios with the --prod flag, I get following error: typescript error Cannot determine the module for class OverlayPortal in C:/.../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 C:/.../node_modules/ionic-angular/umd/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it. Cannot determine the module for

SEO in Ionic PWA

橙三吉。 提交于 2019-12-24 10:24:11
问题 I just finished building a PWA using Ionic. Now i am stuck in making PWA SEO enabled. Since in ionic there is #(Hash location strategy) enabled in ionic and this results in # in all of the urls which doesn't help at all in SEO. So to remove # I tried setting Path location strategy {locationStrategy: 'path'} in AppModule. This removes the # from the url. But when I try to refresh it or go directly to a url, it returns 'Cannot GET /url' Few things I read for this problem is to rewrite to index

Ionic 4 Http failure response for (unknown url): 0 Unknown Error. when calling api on real device

时光怂恿深爱的人放手 提交于 2019-12-24 10:02:58
问题 I have an ionic 4 application which calls a .NET Core backend api. It works correctly on chrome browser, but when I run apk on android device, the response is: {"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url): 0 Unknown Error","error":{"isTrusted":true}} regarding to header I appended these options: const httpOptions = { headers: new

Ionic webview for android makes the whole division shift up while clicking on input boxed

岁酱吖の 提交于 2019-12-24 09:48:06
问题 I am using Ionic v3.10, below is my login HTML code <ion-content> <ion-grid> <ion-row> <ion-col col-12> <ion-list> <ion-card> <ion-card-header> <ion-img style="background-color: transparent; display: block; margin: auto;" height="100" width="100" src="assets/logo.png" alt="iBin"></ion-img> </ion-card-header> <ion-card-content> <ion-item ion-fixed> <ion-label floating>Username</ion-label> <ion-input type="text"></ion-input> </ion-item> <ion-item ion-fixed> <ion-label floating>Password</ion

How can I open another app using intents in ionic?

孤人 提交于 2019-12-24 09:13:00
问题 I have tried the following markup but it does nothing <ion-header-bar class="bar-dark"> <h1 class="title title-left">App Title</h1> <a class="button rate-me button-light" href="amzn://apps/here">Rate</a> </ion-header-bar> I thought may be it is because no app to handle the intent is installed. So, I tried the following markup: <ion-header-bar class="bar-dark"> <h1 class="title title-left">App Title</h1> <a class="button rate-me button-light" href="http://link-to/app/here">Rate</a> </ion