Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 230639 articles
Browse latest View live

Ionic 5 - Ion back button does not Reload current tab page

$
0
0

Hi All

I have an app that is using tabs and every pop current page using the ion back button, the current page does not reload.

Any suggestion or solutions ?

Thanks


Capacitor Firebase analytics fails iOS

$
0
0

Trying to build iOS of my app that “should” use firebase analytics

It fails with

ArgumentError - Illformed requirement `"$IOS_FIREBASE_ANALYTICS_VERSION"

I installed it thus

npm install cordova-plugin-analytics
npm install @ionic-native/analytics-firebase
ionic cap sync

and the ionic cap sync command was successful.

Ionic 5 and angular httpclient request is working on system but not working on android device

Ionic life cycle not working as expected when we create blank project for ionic-react

$
0
0

I believe it is because the pages are still in the DOM. What are you trying to accomplish?

Ionic 5 and angular httpclient request is working on system but not working on android device

$
0
0

No, instead of monsters like /RAMANUJAN_GURUCOOL/RAMANUJAN_APP/get_fleet_expense_month.php?Database=’+Db+’&MonthAcademicYear=’+this.AcademicYear+’&MonthBusNo=’+this.BusNo.

let params = new HttpParams()
  .set("foo", "bar")
  .set("baz", "quux");
http.get(url, {params});

Ionic life cycle not working as expected when we create blank project for ionic-react

$
0
0

I’m fetching data from API in useIonViewWillEnter method but at the time of leaving this page that useIonViewWillEnter and useIonViewDidEnter executing again instead of useIonViewWillLeave and useIonViewDidLeave.

Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 6 of the parameter list is invalid

$
0
0
ERROR Error: Uncaught (in promise): Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 6 of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.

Please check that 1) the type for the parameter at index 6 is correct and 2) the correct Angular decorators are defined for this class and its ancestors.
Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 6 of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.

Please check that 1) the type for the parameter at index 6 is correct and 2) the correct Angular decorators are defined for this class and its ancestors.

Don’t know why this error, didnt see it before and adding Injectable() doesnt help, my code is this:

import { Component, Injectable, OnInit } from '@angular/core';
import { UserService } from 'src/app/services/user/user.service';
import { map } from 'rxjs/operators';
import { User } from 'src/app/models/user';
import { Router } from '@angular/router';
import { ChatsService } from 'src/app/services/chats/chats.service';
import { UtilService } from 'src/app/services/util/util.service';

@Component({
  selector: 'app-users',
  templateUrl: './users.page.html',
  styleUrls: ['./users.page.scss'],
})

export class UsersPage implements OnInit {

  users: User[];
  uid: string;

  constructor(private userService: UserService,
    private router: Router, 
    private chatsService: ChatsService, 
    private util: UtilService) {
    this.util.doLoading('Please Wait...');
    this.userService.getAllUsers().snapshotChanges().pipe(
      map(changes => changes.map(c => ({
        key: c.payload.key, ...c.payload.val()
      }))
      )).subscribe(
        users => { this.users = users; console.log(users) })
    this.uid = this.userService.getUID();
  }

  openChat(key: string) {
    console.log("My key: ", key)
    this.chatsService.chatter = {
      uid: this.uid,
      interlocutorUID: key
    }
    this.router.navigateByUrl('/chat-view')
  }

  ngOnInit() {

  }

}

Empty result after execute first observable subscribe inside foreach to end

$
0
0

Hi,
I’m using ionic 3, angular 5,
I’m not sure what’s wrong with my code, I have the result always empty of observable inside foreach. Here’s my code:

articlepanier : Article[] = [];
		this.storage.get(TOKEN_KEY).then(token => {
		  let isExpired = helper.isTokenExpired(token);
		  if(!isExpired){  
			//foreach loop 
			this.cart.forEach((element, index) => {
			var article = new Article();
			article.artid = element.artid;
			article.artcode = element.artcode;
			//value of the sales unit quantity
			article.plvqteuv = element.amount;
			
			let data = {
				pricode: this.pricode,
				artcode: element.artcode
			};

			//use observable to return stock available in the database  
			//and change the value of the article.plvqtyisvalid by false value at each line 
			//if the quantity entered exceeds the quantity available
			this.cardProvider.stockbyarticle(data).subscribe((res: any) => {
			  if( res.ardstksoc < element.amount ){
				//change boolean status quantity is valid
				article.plvqtyisvalid = false;
			  }
			  
			  //method changes the contents of array
			  this.articlepanier.splice(index, 0, article);
			  
				console.log(this.articlepanier);
			});
				
		});

		//Here outside of foreach, I want the result of array after executing foreach (this.articlepanier) to be used in a if condition 
		//But articlepanier is always empty

		if(this.articlepanier.filter(c =>(c.plvqtyisvalid  == true).length > 0){
			//recording the card in database 
		}
	  
	  });

I want the result of observable inside foreach but this.articlepanier is always empty


Spell check is not working on mobile

Ionic Prod Build Error

$
0
0

hey i am getting the same error on navigating the tabs. Can you please share the solution which worked for you . Thanks in advance .

2020-10-09 12:33:35.216 19484-19484/io.ionic.starter E/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 39108 - Msg: ERROR Error: Uncaught (in promise): Error: Cannot activate an already activated outlet
    Error: Cannot activate an already activated outlet
        at IonRouterOutlet.activateWith (http://localhost/vendor-es2015.js:106445:19)
        at ActivateRoutes.activateRoutes (http://localhost/vendor-es2015.js:80059:40)

Error: Cannot activate an already activated outlet

$
0
0

Hey I am getting the same error . Can you tell me where exactly was the issue

2020-10-09 12:33:35.216 19484-19484/io.ionic.starter E/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 39108 - Msg: ERROR Error: Uncaught (in promise): Error: Cannot activate an already activated outlet
    Error: Cannot activate an already activated outlet
        at IonRouterOutlet.activateWith (http://localhost/vendor-es2015.js:106445:19)
        at ActivateRoutes.activateRoutes (http://localhost/vendor-es2015.js:80059:40)

Ionic in app browser before load event

$
0
0

ionic in app browser before load event is working fine in android but on iphone it is triger just first time after the browser appears on screen the before load event not workin
Note working fine on android

How to set name of iOS Xcode Project from Capacitor

Ionic 5 + Angular LoadingController with Http Interceptor Loader Present and Dismiss issue

$
0
0

I tried this one also but not working it’s behaviour seems like my 2nd approach… If you seen my approach 2 then check that one. it’s happening like dismissing before completing all the requests

find the sample code git repo

How to detect platform on ionic stencil project?

$
0
0

I’m using a ionic-stencil-starter-pwa project https://github.com/ionic-team/ionic-pwa-toolkit and I need to detect the platform because I will build the app using appflow for ios and android and I need to do some things only in a certain platform.

I don’t use cordova or angular but vanilla javascript.

I’ve found this https://ionicframework.com/docs/native/device and I’ve installed it but I have doubts how to use it.

import { Device } from '@ionic-native/device';

...
export class myClass {
  ....
  device: typeof Device;
...

but if I do “npm run build” i have this error:

[ ERROR ]  TypeScript: ./node_modules/@ionic-native/device/index.d.ts:1:35
           Cannot find module '@ionic-native/core' or its corresponding type declarations.

      L1:  import { IonicNativePlugin } from '@ionic-native/core';
      L2:  /**

I don’t really understand why this problem appears because I’ve installed the plugin like the documentation says


WKWebview: Cross origin requests are only supported for HTTP

Include Commit Build inside Ionic App

$
0
0

Hey @rapropos

thanks a lot, but I found a different approach before I saw your solution… cause I have to build a Docker Image anyway to deploy it later on (Web/PWA).

This is what I do - it is basically just a Dockerfile:

FROM node:12.18.4-alpine3.9 as builder
COPY . /www
RUN apk add --no-cache git
RUN npm install -g ionic@latest
RUN npm install -g gen-app-version
WORKDIR /www
RUN npm install --save-dev --unsafe-perm node-sass
RUN npm link @angular/cli
RUN ng add @angular/pwa
RUN genAppVersionTS
RUN npm run-script prod
FROM pagespeed/nginx-pagespeed:stable
COPY ./nginx/ionic.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /www/www/ /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html

And within the code I just import the .ts file and output it in the .html file, e.g.

.ts file:

import { Component, OnInit, Input } from '@angular/core';
import { VERSION } from '../../../app-version';
...
export class TestComponent implements OnInit {
  @Input() name: string;
  readonly commit_info = VERSION;

  constructor() { }

.html file:

...
<small>V#{{commit_info.hash}}s</small>
...

And it really works perfect.

My deploy pipeline is kinda complex – I’m using Appflow and DO Apps.

Local -> Gitlab.com (Dev branch) -> Gitlab.com (Merge Branche Dev->Master) -> Sync Mirror Repository Github.com -> Github.com (On New Commit) -> New DO App Rollout

But works at the current step perfect. A lot less work compared to what I did before based on private Gitlab (CI/CD), Private Registry & Kubernetes.

Thanks again & cheers,
Olli

Access contacts on IOS

Ion-select does not show selected option when value is an object type

$
0
0

I am trying to use select-option values as objects.

 <ion-item>
    <ion-label>Choose</ion-label>
    <ion-select [value]="{key:'abc',value:'ABC'}">
      <ion-select-option value="{key:'abc',value:'ABC'}">ABC</ion-select-option>
      <ion-select-option value="{key:'pqr',value:'PQR'}">PQR</ion-select-option>
      <ion-select-option value="{key:'xyz',value:'XYZ'}">XYZ</ion-select-option>
    </ion-select>
  </ion-item>

When popup opens it does not show the selected value.

Ionic contacts fetch does not properly on iOS

$
0
0

Hii @champion007,

Can you please help with how to fetch contacts from iOS device.
As currently I’m not able to fetch contacts. I’m getting a weird error.

Thank you

Viewing all 230639 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>