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

Focus is not pointing to first input


Why toggle button is fired even if it unchecked?

$
0
0

I have a toggle button. When it is ONLY checked, I want to call a function.
The problem is it is also called when I uncheck it.
How can I fix that?

My component view file:

<ion-grid class="geoGrid">
      <ion-row justify-content-center align-items-center>
        <ion-col>
          <ion-label position="stacked" class="geoLabel"
            >Use current location</ion-label
          >
        </ion-col>
        <ion-col class="geoToggle">
          <ion-item lines="none">
            <ion-toggle
              slot="start"
              name="blueberry"
              [(ngModel)]="isActive"
              (ionChange)="getGeoLocation($event)"
            ></ion-toggle>
          </ion-item>
        </ion-col>
      </ion-row>
    </ion-grid>

function in .ts file:

  getGeoLocation(event) {
    console.log(event.detail.checked);
    this.geolocation.getCurrentPosition({ maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }).then((resp: any) => {
      this.locationPermissionsDenied = false;
      this.geoLatitude = resp.coords.latitude;
      this.geoLongitude = resp.coords.longitude;
      const city = {
        isActive: this.isActive,
        latitude: this.geoLatitude,
        longitude: this.geoLongitude
      };
      console.log(this.isActive);
      this.httpService.changeIsActive(this.isActive);
      this.httpService.changeCity(city);
    }).catch((error) => {
      alert('Error getting location ' + JSON.stringify(error));
    });
  }

Cordova-plugin-fcm-with-dependecy-updated plugin

$
0
0

Can you please share your error log for android build?

Err: Uncaught (in promise): plugin_not_installed

$
0
0

That is what I did… there is no more detailed error, just plugin not installed and some links to polyfill.js file where is nothing, what will help me to find out, which plugin I need to install. Isnt there any config option somewhere, that will give me more detailed info?

Err: Uncaught (in promise): plugin_not_installed

$
0
0

make sure all plugins are loaded inside platfom.ready();

[formControlName] not working

$
0
0

Hi,
I’m using Angular8 with Ionic 4. I create dynamic reactive forms. In a loop I have the following code

<ng-container *ngIf="type === 'input'">
    <ion-input [fromControlName]="property.formPropertyName"></ion-input>
</ng-container>

And this error:

compiler.js:2420 Uncaught Error: Template parse errors:
Can’t bind to ‘fromControlName’ since it isn’t a known property of ‘ion-input’.

  1. If ‘ion-input’ is an Angular component and it has ‘’ input, then verify that it is part of this module.

If I remove the brackets
<ion-input class="title standardTitleLabel" fromControlName="property.formPropertyName"></ion-input>

the code works fine

Why is that so?

App sound is playing on Background mode

$
0
0

I am playing a sound using the Holwer.js library, and I am playing a sound track. However, when I leave the app, it contiens to play on the standby mode.

I tried adding the BackgroundMode module and disabling manually, but this isn’t doing it.

any idea? :frowning:

Err: Uncaught (in promise): plugin_not_installed

$
0
0

I am sure about it… It does not do when I run it on Android device, but on iOS it does…

As I said, is there way to get to know which plugin it try to use?


How to hide an ion-back-button for lg and xl screens

$
0
0

Hi,

I want to hide the when the display is lg or xl.

I have a side menu and the back button is showing on the toolbar of the main content screen when the screen / menu is expanded in LG and XL.

I am using split-pane.

I tried to use the i-hide-lg css but can’t seem to get it right.

Any help will be great!
Thanks

Google docs link to ionic 4 app

$
0
0

Noted, thank you so much for advising me, I really appreciate it.

Firebase storage on Ionic 4

$
0
0

Hi, thank you so much for responding. May I know after uploading the PDFs in your firebase storage, how do you display (link) it in your ionic 4 app?

Logout from menu and re-login menu button not working

$
0
0

Hi, I ended up redirecting to another child page which had a timer on it and then it ran the logout method. For some reason the logout method on the menu / app.component.ts was not happy.

Thanks for the previous messages.

Visual studio crashing with one particular project

$
0
0

Hello,

I am having a problem with my ionic 4 project. Visual studio crashes whenever I open it.

I am able to enter the project and maybe do a little bit of work, then will eventually crash.

In the task manager what is really strange is, the disk is at 100%. But I cannot see any programs on the computer that are occupying a lot of space.

Has anyone experienced something similar???

Ionic run android works BUT apk does not access internet

$
0
0

you saved mi life! after hours of struggling this solved my issue, thanks!

Build in "prod" mode: Cannot find module "."

$
0
0

I’d commented on this thread earlier that using TypeScript 2.8.x solves this prod build issue.
While I was able to fix my code that was using some TypeScript 3.x features, I am now facing some package dependencies which have type files (.d.ts) which do not compile unless I am using TypeScript 3.x! So I (and others) may be in a bind.

So, what is the official word? Will Ionic 3 apps never be able to use TypeScript 3? Does this count as a “major bug” with regard to official support for Ionic 3?


Accessing Cordova webapp inside another webview

$
0
0

This may seem like a very weird question, but I’ll try to explain throughout the post.

We have an Ionic v3/Angular 5/Cordova web app (using the cordova platform browser) deployed on a static web server. (Just a clarification before someone questions on why we are using Ionic for this, we previously had the same app published in the AppStore and Google Play at first, and that is the reason we use platform browser until now. Also, we have some features like deeplinks redirects that require cordova plugins)

We are developing a new Ionic v4 with React and Capacitor, and while some of our older web apps are not completely migrated to Ionic/React, we are “embedding” them inside our Capacitor app using the main Capacitor Webview to direct the user to our web urls for the old apps. The old apps were adapted to provide a link back to the local files, so that the user experience is almost seamless when navigating between the new app and the old webapps.

Our other pure javascript webapps work perfectly that way.

However, when we try to do that with the Cordova Web App, for some reason the webapp fails to load the Cordova plugins (like deeplinks) and this completely breaks our solution. It seems like the webapp, even though it is being accessed in a public url (https:/app.domain.com) realizes that it is running in a Native webview and looks for the plugins in local files.

Does anyone have any idea on how to avoid that behavior from Cordova?

How to remove yellow focus-border around buttons in Android apps?

Correct way to handle asynchronous call & return in Typescript

$
0
0

Hi
I’m working on an Ionic 4 project. This is quite new for me to work in Javascript / Typescript and i’m having a hard time to understand how to use properly async / await / promise and all that stuff.

What i have :

On a page of my app (Let’s call it tab1.page.ts ) I have a function that call a function of my service :

Get_Sim_Agents() {
       this.simConfig.Get_Sim_Agents();
    }

On my service page, here is the function : (a basic http get function) :

/**
     * Fetch the datas in order to populate the app
     * */
    Get_Sim_Agents(){

        this.http.get(
            "http://" +
            this.ip_address +
            ":" +
            this.port +
            "/get_datas"
        ).subscribe(response => {

            var data = JSON.stringify(response, null, 2);

            try {
                var obj = JSON.parse(data);
                // here i do stuff with the retrieved data
                });

            } catch (e) {
                console.log(e);
            }
        });
    }

And everything is working. But i would like my service function to return the data as a string when the data is retrieved & treated. I’m having a hard time finding the correct syntax.
Here is what i tryed :

On my service :

/**
     * Fetch the Sim_Agents from the Simulation_orchestrator in order to populate the app
     * */
    async Get_Sim_Agents() : Promise<string>{

        this.http.get(
            "http://" +
            this.simulation_orchestrator_ip_address +
            ":" +
            this.simulation_orchestrator_port +
            "/get_sim_agents"
        ).subscribe(response => {

            var data = JSON.stringify(response, null, 2);

            // here i do some stuff about the data

            return JSON.parse(data);
            });

        return 'test';
    }

On my page :

Get_Sim_Agents() {
        this.simConfig.Get_Sim_Agents().then((result) => {console.log(result)});
    }

With this code my function called on my page return ‘test’ right away. I would like it to wait until the http get return the server response. I tryed several different syntax but couldn’t achieved what i want :confused:

I someone could help me to overcome this trouble i would be gratefull <3

Cordova-plugin-fcm-with-dependecy-updated plugin

$
0
0

Configure project :app
FCM PLUGIN GRADLE TOOLS VERSION: 3.5.0google-services.json not found, google-services plugin not applied. Push Notifications won’t work
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/debug]

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:app’.

org.gradle.api.internal.tasks.DefaultTaskContainer$DuplicateTaskException: Cannot add task ‘processDebugGoogleServices’ as a task with that name already exists.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

CONFIGURE FAILED in 0s
Cannot add task ‘processDebugGoogleServices’ as a task with that name already exists.

Correct way to handle asynchronous call & return in Typescript

$
0
0

tab1.page.ts

Get_Sim_Agents() {
       this.simConfig.Get_Sim_Agents()
                  .subscribe( ... all that stuff)
    }

ps. stringifying and then parsing the response seems a waste. Not sure why you are doing that.

the service:

 Get_Sim_Agents() : Observable<string>{

        return this.http.get(
            "http://" +
            this.simulation_orchestrator_ip_address +
            ":" +
            this.simulation_orchestrator_port +
            "/get_sim_agents"
        );
}

You either go for promises (async await) or observables (subscribe). You can mix them as you are trying in your code but that is a waste of your time, the app and the intellect of the people that invented both concepts. My opinion. :slight_smile:

And mostly if you have a service, every method of the service returns something. So the first word to type is return. Any method in the service that doesn’t, needs critical scrutiny or made private.

Pretty sure there is more to comment about the code, but this seems to be the core/first step of the answer to your question.

Viewing all 228514 articles
Browse latest View live


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