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

Unable to send socket object throgh service

$
0
0

Hi, I have socket object in one component, I want to use socket object in other component , so am using services, am setting value into the service and trying to get through another component by using service object it is giving undefined . SO please help me.
below is my sample code.

makeSocketConnection() {
    var url = "http://" + this.ip + ":" + this.port + "/";

    if(this.socket===undefined||!this.socket.connected){
      console.log("establishing socket connection undefined");
      this.socket = io(url);
      this.socket.emit('add user', this.user);    
      this.storage.set('socket',this.socket) ;//sets socket object
   //   this.newMessage();
  this.chatService.setSocket(this.socket);//sets socket object
    }  
  }

am setting a socket object by this.chatService.setSocket(this.socket)

and am trying to getin other component like below

`this.storage.get('socket').then((val) => {
  
 console.log(" socket obj is "+val);//giving undefined
}); 

 console.log(" this.dummytest is "+this.chatService.getSocket());--//giving undefined

`

Ion-slides with react

$
0
0

Try putting ion-slides inside ion-content. Also try IonSlides and IonSlide

Multiple IonTabs + IonMenu brеаks navigation

$
0
0

To demonstrate the problem I’ve created the default sidemenu ionic/react app and added two independent tab roots which are accessed from the side menu. TabRoot1 contains Tab1 and Tab2 and TabRoot2 contains Tab3 and Tab4. Each TabRoot has its own IonRouterOutlet defining the routes to its tabs.

Everything works fine on the first visit to any tab root/tab, once you switch between tab roots in the side menu the navigation gets broken. What am I missing? Already spent 3 days on this without any solution at all.

The complete demo project code can be found here:

Thanks in advance.

Ion-select with icon

$
0
0

you need to do this

this.sectionSelect.interface = 'popover'; // or alert or action-sheet
this.sectionSelect.open(event);

[ERROR] An error occurred while running subprocess cordova

Fcm with Firebase dynamiclinks showing error for IOS in ionic

Why my navigate is not working

$
0
0

The blank path in app-routing.module.ts refers to the staring page for the app.
Now it is set to the home you should change it to login to load login page at the start.

{ path: ‘’, redirectTo: ‘login’, pathMatch: ‘full’ },

Help in sending Get Request in Ionic

$
0
0

Hi Geoff,

I did get the data using my ionic app from the url endpoint you’ve provided. Will try to implement the same thing with my REST API later when I get home. Gonna keep you posted.

Thanks!


Google auth and Firebase push notifications

$
0
0

I am trying to integrate integrate with Google auth and Firebase push notifications in my Ionic 4/Capacitor project.

Problem is, the Google auth one has a GoogleService-Info.plist, and the Firebase one has the same file, both with a key CLIENT_ID with different values (one for Google app and one for Firebase app), and I could only get either but not both work.

Has anyone integrated with Google auth and Firebase push notifications in your Ionic 4/Capacitor project?

Why my navigate is not working

$
0
0

It’s not work.
I wrote console.log in the constructor and ionViewWillEnter of login.page.ts, but it does not seem to be called.

File Chooser plugin in ionic

$
0
0

How can we extract only audio from file manager using File Chooser

getAudio() {
      // let filter={"mime": "audio/mp3"}
    this.filechooser.open({ "mime": "audio/mp3" }).then
    (uri => {
    console.log(uri+" THE VALUE OF THE URI")
    this.filepath.resolveNativePath(uri).then(path =>
      {
        console.log("path After the resolved native path"+path)
          this.copyFileToLocalDir(path);
         
      
      })
    // this.copyFileToLocalDir(uri);
    })
    .catch(e => console.log(e));
       
    }

i’ve tried above code , its does what i asked it lists only audio,but the problem is i cant select is …is there is anyother way or any other plugin to perform this duty

iCloud directories - Capacitor Filesystem

$
0
0

Hi! :wave:

I want to store some files on the phone, but I dont’t want them to be backed up to iCloud.

Capacitor Filesystem

The document above says, that there are directories, that are not backed up by the cloud, but I don’t know which one of them it is. (Application, Documents, Data, Cache)

Can anyone help me with this?

Cannot read property 'length' of undefined -v

$
0
0

Android Studio project detected
ANDROID_HOME=C:\Users\shubham.katkamwar\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_161
studio
Cannot read property ‘length’ of undefined
[ERROR] An error occurred while running subprocess Cordova.

    cordova.cmd build android --device exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

ionic info:
F:\T&E\BlankProject\BlankProject>ionic info

Ionic:

Ionic CLI : 6.0.0

(C:\Users\shubham.katkamwar\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2

Capacitor:

Capacitor CLI : 1.5.0
@capacitor/core : 1.5.0

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 4 other plugins)

Utility:

cordova-res : 0.8.1
native-run : 0.3.0

System:

Android SDK Tools : 26.1.1 (C:\Users\shubham.katkamwar\AppData\Local\Android\Sdk)
NodeJS : v10.14.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

getting this error while running on android devices.

also https://developer.android.com/studio/install
properly install android studio with all environment variable like platform,
bin, ADB, android home SDK, android home, etc.

leads will be appreciated…!
Thank you in advance.

[Ionic 4] ion-select and change detection

[Ionic 4] ion-select and change detection

$
0
0

I tried everything frome setTimeout to zone.run to changeDetectorRef. In the end I found out the object values are not matched because two object were not referring to same memory location. I tried compareWith property of select component.

@ViewChild(IonSelect, {static: true}) select: IonSelect;
this.select.compareWith = () => {
  return // logic that returns boolean that decides a selected value
} 

Hope it helps.


Import { resolve } from 'path' not working - Ionic V4

$
0
0

Hello,

i try to chain promises so i get rid of nesting promises in promises…

It is an Ionic Angular project.

i would like to work with ‘resolve’ and ‘reject’, but i cannot import it. This is my code in home.page.ts:

import { Component, OnInit } from '@angular/core';
import { resolve } from 'path';
import { reject } from 'q';

export class HomePage implements OnInit {

   ngOnInit() {

       this.nativeStorage.getItem("something").then(
      success => {

        resolve("ok");

      },

      error => {

        reject("error");

      }
    ).then(
      success => {

        console.log(success);

      }, error => {

        console.log(error);

      }
    ) //continue with chain here

   }

}

I do get the error on compiling, that

ERROR in src/app/home/home.page.ts:4:25 - error TS2307: Cannot find module 'path'.
4 import { resolve } from 'path';
                                      ~~~~~~
[ERROR] An error occurred while running subprocess ng.
        ng run app:ionic-cordova-build --platform=android exited with exit code 1.
        Re-running this command with the --verbose flag may provide more information.

Thanks in advance, Louis

My ionic app is taking too long (nearly 47sec) to load

$
0
0

bro i am now facing the same issue did u solved it ?
in debug mode of chrome -> in network tab -> cordova_plugin.js is pending for 40seconds and then it loads and login page loads

Angular HTTP Client

$
0
0

Hey, i am currently developing an App for my graduation at a higher technical collage.

My problem is that, my app does not get any data on mobile devices. Is it possible that the HTTPClient from Angular does not work on mobile devices? Please be not distracted by the localhost, i use a VPN to be in the network where the backend runs.

Could you please tell me what i have to use or whats the problem? I could not find any satisfying solutions online.

Here is my ApiDataService:

import { HttpClient } from ‘@angular/common/http’;

@Injectable({
providedIn: ‘root’
})
export class APIDataService {

private api = ‘http://localhost:11218/lehrer’;
private id = ‘SCRE’;

private gruppen: Gruppe;
private schueler: Schueler;

constructor(
private http: HttpClient,
private storage: Storage
) { }

getGruppen(): Observable<Gruppe> {
return this.http.get<Gruppe>(${this.api}/gruppen/${this.id});
}

getSchuelerFromGruppe(grpId: number): Observable<Schueler> {
return this.http.get<Schueler>(${this.api}/schueler/gruppen/${grpId});
}

Angular HTTP Client

$
0
0

Do you get any error or are you getting null data?

Angular HTTP Client

$
0
0

Does changing http to https make any difference?

Viewing all 228514 articles
Browse latest View live


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