Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 70856 articles
Browse latest View live

Dockerizing ionic application

$
0
0

Hi, I am new to DevOps culture
I am trying to dockerize and run my ionic sample application using ionic serve command …I have created a docker file and docker-compose file
image is created for my application but when I build using docker-compose I am getting an error

dockerfile
FROM node:12.16.3

WORKDIR Home/Documents/xxxx/ionic

//Install Ionic and Cordova
RUN npm i -g ionic cordova

//Show ionic cli command
ENTRYPOINT [“ionic”]
CMD [“serve”, “8100”]

docker-compose file
app:
build: .
ports:
- ‘8100:8100’
- ‘35729:35729’
volumes:
- .:Home/Documents/xxxx/ionic
- Home/Documents/xxxx/ionic/node_modules
command: ionic serve --all

I will be thankful if anyone corrects/guide my mistakes or help me with the flow
I am using Ubuntu v18.04, ionic v5.4.16 and node v12.16.3

1 post - 1 participant

Read full topic


Ionic slides with icon loop

$
0
0

Hi, I’m trying to implement a loop slider from an array with icons. Something like this:
stackblitz

      <ion-slides pager="true" [options]="slideOpts">
        <ion-slide *ngFor="let feature of features">
          <ion-card>
            <ion-card-header>
              <ion-icon size="large" [name]="feature.icon"></ion-icon>
            </ion-card-header>
          </ion-card>
        </ion-slide>
      </ion-slides>

But the icons are shown only on the “first repeat” (please see the example).

Anyone know haw can solve?
Thanks
Davide

1 post - 1 participant

Read full topic

Ionic g pipe search-filter not working in ionic 5

$
0
0

I tried to create a pipe filter by using following cli.

ionic g pipe search-filter

but I get this error message.

ng generate pipe search-filter --project=app More than one module matches. Use skip-import option to skip importing the component into the closest module.

Of course, ionic g page pages/login works well
Please let me know how to fix the problem in creating new pipe.
Thank you

1 post - 1 participant

Read full topic

Ionic animation in ionic 5

$
0
0

I’m having trouble doing some simple animation with ionic v5. This is my html

<div *ngIf="products.length > 0">
  <ion-list *ngFor="let pro of products" class="list">
    <ion-item>
      <ion-grid>
        <ion-row>
          <ion-col>
            // Making it simpler
          </ion-col>
        </ion-row>
      </ion-grid>
   </ion-item>
 </ion-list>
</div>

And this is ts

ionViewDidEnter() {
    const animation = this.animationCtrl.create()
      .addElement(document.querySelectorAll('.list'))
      .duration(1200)
      .iterations(1)
      .keyframes([
        { offset: 0, transform: 'translateY(-75px)', opacity: '0' },
        { offset: 0.3, transform: 'translateY(35px)', opacity: '0.5' },
        { offset: 1, transform: 'translateY(0px)', opacity: '1' }
      ]);

    animation.play();
  }

Now the problem is when the page shows whole list items animate at once while I want to animate each ion-item one by one. If I use document.querySelector instead of document.querySelectorAll only first ion-item got animated.

Please any help will be appreciated.

1 post - 1 participant

Read full topic

MS ADAL Integration : Authentication failed Error: User cancelled the flow RequestId

$
0
0

Hi all,

I am try to integrate Ms ADAL on ionic 4 but
i am getting

Authentication failed Error: User cancelled the flow RequestId

Any help pls :slightly_smiling_face:

My code :

import { MSAdal, AuthenticationContext, AuthenticationResult } from '@ionic-native/ms-adal/ngx';

constructor(
private msAdal: MSAdal
  ) {}

  let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');
      authContext.acquireTokenAsync('https://graph.windows.net', 'MY-ID-CLIENT', 'http://localhost:8000/','','')
      .then((authResponse: AuthenticationResult) => {
        console.log('Token is' , authResponse.accessToken);
        console.log('Token will expire on', authResponse.expiresOn);
      })
      .catch((e: any) => console.log('Authentication failed', e));

1 post - 1 participant

Read full topic

Ion2-calendar not highlighted/selected when clicked on dates

$
0
0

I have added one calendar library from the below link for one of my project on IONIC 3, https://github.com/HsuanXyz/ion2-calendar/tree/v2

CalendarBookPage contains both calendar modal and razorpay payment gateway to book the service according to the calendar multi selected days. everything is working fine in case of first time calendar multi slection dates and payment. after successfully paid i am redirecting page to homepage , then after when i entering the CalendarBookPage again to select the dates, dates are not highlighted and am getting stuck at multi selection dates.

HTML code:

<ion-content padding class="card-section">
  <ion-list class="allpageform alltabledt">

    <ion-grid no-padding>
      <ion-row no-padding>

        <ion-col col-12 class="" *ngIf="this.package_type != 'long-term' && service_id != '6'">
    <ion-item no-padding>
                <ion-calendar #myCalendar [(ngModel)]="dateMulti" [options]="optionsMulti" [type]="'string'" [format]="'YYYY-MM-DD'"
                  (onChange)="selectedMultiDates($event)">
                </ion-calendar>
              </ion-item>
</ion-row>
    </ion-grid>
  </ion-list>
</ion-content>

<ion-footer no-padding class="footerbtnsec" (click)="btnBookService()">
  <button ion-button full class="btnshadownone">
    Book Now
  </button>
</ion-footer>

TS File:

export class CalendarBookPage {
dateMulti: string[];
optionsMulti: CalendarComponentOptions = {
    pickMode: 'multi'
  };

constructor(){}

ionViewDidLoad(){
var today = new Date();
var start_date = moment(today).format('YYYY-MM-DD');
this.dateMulti = [start_date];
}
selectedMultiDates(dates) {
console.log(dates); 
}

btnBookService(){
var options = {
      description: 'HealthCare',
      image: 'assets/imgs/d_care_logo.svg',
      currency: this.currency,
      key: this.razor_key,
      amount: finalAmount,
      name: packageName,
      prefill: {
        email: this.userEmail,
        contact: this.userMob,
        name: username
      },
      theme: {
        color: '#F37254'
      },
      modal: {
        ondismiss: () => {
          alert('dismissed')
        }
      }
    };
var successCallback = (payment_id) => {
this.navCtrl.push(SuccessPage);
};

var cancelCallback = (error) => { 
alert(error.description);
};
RazorpayCheckout.open(options, successCallback, cancelCallback);
}

Please suggest any… Thanks in advance!!!

1 post - 1 participant

Read full topic

Ionic 5 Angular Tabs static display

$
0
0

Hoping to get some eyes on my SO question

With the ion-tab element replaced by ion-tab-bar & Angular Routing (as documented in the breaking changes) - is there another way of displaying “static tabs”?

The routing/lazy loading is great for certain scenarios, but not when I want to share my object between tabs.
The Usage Docs for JavaScript still show the usage of ion-tab , which would work perfectly for me. Something like this:

<ion-tabs>

  <ion-tab tab="tab-schedule">
    Static content {{foo.schedule}}
  </ion-tab>

  <ion-tab tab="tab-speaker">
    Static content {{foo.speaker}}
  </ion-tab>

  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="tab-schedule">
      <ion-label>Schedule</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="tab-speaker">
      <ion-label>Speakers</ion-label>
    </ion-tab-button>
  </ion-tab-bar>

</ion-tabs>

Is there another way I can accomplish this behaviour in Ionic 5 Angular?

1 post - 1 participant

Read full topic

Builders in chembur

$
0
0

Safal Group is a real estate developer primarily known for launching premium residential projects in Mumbai. Safal stands as an epitome of quality having already completed close to 1500 houses across Mumbai & Navi Mumbai. Know more about our upcoming, ongoing projects at

1 post - 1 participant

Read full topic


Allow multiple menus

$
0
0

This question seems related, but is sadly unanswered and also seems to be Ionic+Angular: How to make multiple side menus working in a mobile browser

My app uses a navigation menu that allows switching between different pages. And depending on the page there’s also a context menu.

I can’t figure out how to make these two IonMenus coexist.
The goal is to have two IonMenuButtons in the page header. One on the left, for the navigation menu. The other on the right for the context menu.

To create a simple example, I set up a blank project with ionic start and added [two of the example menus from the docs page][1] next to the router. Now <App/> looks like this:

const App: React.FC = () => (
  <IonApp>
    {/* */}
    <IonMenu side="start" menuId="first" id='first' contentId="router-outlet">
      <IonHeader>
        <IonToolbar color="primary">
          <IonTitle>Start Menu</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent>
        <IonList>
          <IonItem>Menu Item</IonItem>
        </IonList>
      </IonContent>
    </IonMenu>

    {/* */}
    <IonMenu side="start" menuId="custom" id="custom" contentId="router-outlet">
      <IonHeader>
        <IonToolbar color="tertiary">
          <IonTitle>Custom Menu</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent>
        <IonList>
          <IonItem>Menu Item</IonItem>
        </IonList>
      </IonContent>
    </IonMenu>
    {/* */}
    <IonReactRouter>
      <IonRouterOutlet id="router-outlet">
        <Route path="/home" component={Home} exact={true} />
        <Route exact path="/" render={() => <Redirect to="/home" />} />
      </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>
);

As you can see, the router has only a single route. In the header of that page, I would like to place two IonMenuButtons. Since that doesn’t work, I’m replacing one of them with a simple button:

const Home: React.FC = () => {
  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start">
            {/* <IonMenuButton menu="custom" autoHide={false} /> */}
            <IonButton
              onClick={() => {
                (document.getElementById("custom") as any).open();
              }}
            >
              <IonIcon slot="icon-only" icon={star} />
            </IonButton>
          </IonButtons>
          <IonTitle>Double menu</IonTitle>
          <IonButtons slot="end">
            <IonMenuButton menu="first" autoHide={false} />
          </IonButtons>
        </IonToolbar>
      </IonHeader>

      <IonContent></IonContent>
    </IonPage>
  );
};

Now, this code has a variety of problems:

  • it is not possible to have two IonMenuButtons in the same header (in Home.tsx). Only one of them is rendered, the second one disappears.
  • it is not possible to have two Menus, only the second menu becomes available. In App.tsx I’ve placed the Menu with menuID first before the Menu with menuID custom. Only this second menu with id custom can be opened. Both the IonMenuButton and my hacky workaround button only work when pointing to custom. Switching the order in App.tsx makes only first work.

Link to SO question: https://stackoverflow.com/questions/61953916/ionic-how-to-allow-multiple-menus

1 post - 1 participant

Read full topic

Import a custom font

$
0
0

Hello, i wanted to know how can we import custom font in a Ionic React app ?

Thank you

1 post - 1 participant

Read full topic

Ionic 5 with Angular PWA not working

$
0
0

Hi,

Does anyone face the issue of not working PWA in Ionic5 with Angular? I am trying below commands to create a simple PWA app with Ionic5 and host the same on the firebase. After I deploy it on the firebase it fails to show the “Add to Desktop” option on the chrome browser.

ionic start myPWAIonic blank

cd ./myPWAIonic

ng add @angular/pwa

ng build --prod

firebase init

firebase deploy

Thanks in advance.

1 post - 1 participant

Read full topic

Ionic5 Google Maps with Capacitor

$
0
0

I am upgrading our app to Ionic5 and Google Maps is a key component.
In Ionic5 manner I tried to stick with Capacitor as it it recommended. However,
running Google Maps in the labs / simulator I get in the browser console:

[GoogleMaps]You need to execute "$> ionic cordova run browser"."$> ionic serve" is not supported.

Dependency as in the package.json

"@ionic-native/google-maps": "^5.0.0-beta.27",

It suggests to fall back to cordova. I thought capacitor was the future and I should stay away from Cordova? Or is a hybrid cordova & capacitor mode possible? If so, how?

2 posts - 2 participants

Read full topic

Ionic input keyboard scrolls up contents

$
0
0

Hi there, hope you will be fine. I need some help. I am using ion-textarea in my ionic project and below that I have some buttons. When I build the app and test on android it looks perfect. When I tap on ion-textarea and simply close keyboad without typing anything it works fine but when I tap on ion-textarea and start typing something and then close the keyboard, the content below the ion-textarea scrollls up and does not go down.Here is the screenshot of the error:


Looking forward to see your response, thanks!

1 post - 1 participant

Read full topic

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

$
0
0

I am importing a service in my login page, but when it is giving me this error

Uncaught (in promise): Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 2 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.

i have all the decorators in my service file and i have all the proper imports in my app modules. but i have no idea why is this error still coming ?

loginPage.ts

import { UserService } from "src/app/services/user.service";

 constructor(
    public navCtrl: NavController,
    private userService: UserService,) { }

async doLogin() {
    let loader = await this.loadingCtrl.create({
      message: "Please wait...",
    });
    loader.present();

    this.userService.login(this.account).subscribe(
      (resp) => {
        loader.dismiss();
        this.navCtrl.navigateRoot("");
        //this.push.init();
      })}; 

my userService.ts

import { HttpApiService } from "./httpapi.service";
@Injectable({
  providedIn:"root"
})
export class UserService {
  _user: any;

  constructor(
    private api: HttpApiService,
  ) {}
// all other methods ....
}

my httpApiService

import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";

@Injectable({
  providedIn: "root",
})
export class HttpApiService {
  // LIVE

  constructor(private http: HttpClient) {
    this.url = "my url";
  }

  get(endpoint: string, params?: any, options?): Observable<any> {
    // Support easy query params for GET requests
    if (params) {
      let p = new URLSearchParams();
      for (let k in params) {
        p.set(k, params[k]);
      }
      // Set the search field if we have params and don't already have
      // a search field set in options.
      options.search = (!options.search && p) || options.search;
    }

    return this.http.get(this.url + "/" + endpoint, options);
  }

  post(endpoint: string, body: any, options?): Observable<any> {
    return this.http.post(this.url + "/" + endpoint, body, options);
  }

  put(endpoint: string, body: any, options?): Observable<any> {
    return this.http.put(this.url + "/" + endpoint, body, options);
  }

  delete(endpoint: string, options?): Observable<any> {
    return this.http.delete(this.url + "/" + endpoint, options);
  }

  patch(endpoint: string, body: any, options?): Observable<any> {
    return this.http.put(this.url + "/" + endpoint, body, options);
  }
}

my ionic info

Ionic:

   Ionic CLI                     : 5.2.7 (C:\Users\Adit\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.1.1
   @angular-devkit/build-angular : 0.901.7
   @angular-devkit/schematics    : 9.1.6
   @angular/cli                  : 9.1.7
   @ionic/angular-toolkit        : 2.2.0

Capacitor:

   Capacitor CLI   : 2.1.0
   @capacitor/core : 2.1.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.11.3
   OS     : Windows 10

Please Help and Guide??

1 post - 1 participant

Read full topic

Learn to Build Mobile Apps With Ionic Framework, ReactJS and Capacitor

$
0
0

This is a multi-part video series on how to build a mobile application using reactjs and ionic framework. There will be approximately two videos a week covering topics to build a mobile application on IOS and Android with Ionic and Capacitor

Will be about 2 videos a week walking you through the process of building a mobile app.

1 post - 1 participant

Read full topic


Tags from Ionic 5 docs not working

$
0
0

I have installed the latest version of Ionic Angular with:
npm install -g @ionic/cli

ionic -v shows me 6.9.2

I’ve created a new app using the super starter app, using --type=ionic-angular

I am finding that the tags in the Ionic 5 docs are not working and I have to move back to Ionic 3 tags.

For example:
Ionic 5 tags - Do not work, stay as fixed labels

<ion-item>
  <ion-label position="floating">Floating Label</ion-label>
  <ion-input></ion-input>
</ion-item>

Ionic 3 tags - Working as expected

<ion-item>
    <ion-label floating>Username</ion-label>
    <ion-input type="text"></ion-input>
  </ion-item>

Also, getting some errors like: ion-text is not a known element in code from the Ionic 5 docs.

What am I doing wrong?

1 post - 1 participant

Read full topic

Base64 image doesn't display

$
0
0

Hey, I need to store an image (object File) in order to use it on my app whenever I want. So I’m doing like this:

this.user = this.parse.currentUser;
        this.photo = this.user.get('photo');
        console.log(this.photo);

        const blob = new Blob([this.photo], {type: 'image/jpg'});

        const reader = new FileReader();
        reader.onload = () => {
            console.log(reader.result);
            this.userPhoto = reader.result;
            console.log(this.userPhoto);
        };

        reader.readAsDataURL(blob);

but when I try to display it on HTML like this:

<img src="{{userPhoto}}" class="avatar"
             id="avatar"/>

It doesn’t show the image but an broken image, like this:

image

help please, I’m on this issue for a week now.

1 post - 1 participant

Read full topic

How to select a tab with Ionic5?

$
0
0

Hi,
which is the correct way to select programmatically a tab with Ionic5?

With previous versions of Ionic I used the code:
his.navCtrl.parent.select(tabIndex);

The tabs are defined in this way:

<ion-tabs>

  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="dashboard">
      <ion-icon name="triangle"></ion-icon>
      <ion-label>Tab 1</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="tab2">
      <ion-icon name="ellipse"></ion-icon>
      <ion-label>Tab 2</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="tab3">
      <ion-icon name="square"></ion-icon>
      <ion-label>Tab 3</ion-label>
    </ion-tab-button>
  </ion-tab-bar>

</ion-tabs>

Thank you

Claudio B.

2 posts - 1 participant

Read full topic

Ionic storage doesn't work

$
0
0

I’m following just like https://ionicframework.com/docs/angular/storage says so, but gets the following error:

image

here’s my app module code:

...
import { IonicStorageModule } from '@ionic/storage';

@NgModule({
    declarations: [AppComponent],
    entryComponents: [],
    imports: [BrowserModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        AddCardPageModule,
        ConfirmPageModule,
        SearchPageModule,
        EditProfilePageModule,
        SearchingPageModule,
        RadarPageModule,
        ResultsPageModule,
        AddMembersPageModule,
        AddPayersPageModule,
        CabinPopoverPageModule,
        TicketPopoverPageModule,
        ConfirmTransferPageModule,
        CancelTicketPageModule,
        TransferCabinPageModule,
        EventInfoPageModule,
        HttpClientModule,
        AngularSvgIconModule.forRoot(),
        IonicStorageModule.forRoot()],

    providers: [...

if I remove import {Storage} from '@ionic/storage'; from my LoginPage and from its constructor, the error goes away, but I need to use storage. Help please

1 post - 1 participant

Read full topic

Push Notification Problem

$
0
0

Here is the problem scenario

phonegap-plugin-push(plugin for push-notification)

Overview

  1. phonegap-plugin-push(push notification) is only working on cordova android @7.1.0 which register the device for push notification
  2. When we install cordova-android (latest version) the phonegap-plugin-push(push notification) is not registering device for push notification(with an error that shows that PushNotification plugin is not intall via developer tools console)

Problem

  1. if we have cordova-android version7.1.0 installed the push notification registering device works but whenever we are submiting it to google play store it shows this error:
    “Error: Failed to upload the APK /Users/runner/runners/2.168.2/work/r1/a/_PFM.Mobile.Dev1.FinLocker.Android/drop/app-release-unsigned.apk. Failed with message: Error: Your app currently targets API level 27 and must target at least API level 28…”
  2. if we have cordova-android latest version the push notification plugin does not registering device but since it is higher sdk it pass the submittion to the google play store

Is there any alternative push notification plugin we can use? or how can we resolve this

1 post - 1 participant

Read full topic

Viewing all 70856 articles
Browse latest View live


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