Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 49252 articles
Browse latest View live

Problem with ion-datetime and ngmodel string

$
0
0

@miguelreb wrote:

Hi all,
i have a problem with an ion-datetime component, i have this code in the html:
<ion-datetime displayFormat=“DD/MM/YYYY HH:mm” [pickerOptions]=“customPickerOptionsFecCitaIni” [(ngModel)]=“Parte.CitaFechaHoraIni”>

The field citafechahoraini is a string value, with this format: 08/04/2020 23:45

The customPickerOptions is this:
this.customPickerOptionsFecCitaIni = {
buttons: [{
text: ‘Limpiar’,
handler: () => {
this.Parte.CitaFechaHoraIni = undefined
}
},{
text: ‘Cancelar’,
role:‘cancel’
}, {
text: ‘Guardar’,
handler: (data) => {
this.Parte.CitaFechaHoraIni = data.day.text+"/"+data.month.text+"/"+data.year.text+" “+data.hour.text+”:"+data.minute.text;
}
}]
};

If i open the page, in the datepicker i see this:
datepicker

and when i choose the date i see the month 8 when it will be 4. Why it occurs??
datepicker2

Any help? THANKS!

Posts: 1

Participants: 1

Read full topic


Allow certain elements to be dragged when having a refresher

$
0
0

@stplush wrote:

Currently I have a refresher on my page, a very simple one, that listens to ionRefresh. I also have a google maps on that page in which I place pins, that require updates on refresh.

My problem is that when I scroll on the google maps, the refresher is also being activated. That is not something I want.

I want to prevent the refresher from activating when my swipe starts somewhere on the map. I already tried using event.target.complete() and event.target.cancel() in a (ionStart) method. that works, but after that it completely disables the refresher.

Is there a way to ignore the refresher when I swipe on some element like a maps that has dragging features on it’s own?

Ionic:

Ionic CLI : 6.5.0 (/usr/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.901.0
@angular-devkit/schematics : 9.1.0
@angular/cli : 9.1.0
@ionic/angular-toolkit : 2.2.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.1.3, cordova-plugin-ionic-webview 3.1.2, (and 8 other plugins)

Utility:

cordova-res : not installed
native-run (update available: 1.0.0) : 0.3.0

System:

Android SDK Tools : 26.1.1 (/home//Android/Sdk)
NodeJS : v10.19.0 (/usr/bin/node)
npm : 6.14.4
OS : Linux 4.15
Xcode : xcbuild version 0.1 Build version 1

Posts: 1

Participants: 1

Read full topic

Ion segment scrolls both active and In-active when scroll active section?

$
0
0

@jakesully wrote:

I have two segment tabs for example A and B,
i set default value as A. So A tab will Active and B is in-active. each tab content have different list of contents. If a scroll A tab’s Content it also scroll B tab’s Content. I need separate scrolls for those sections.
This is my code:

 <ion-segment [(ngModel)]="type" mode="md">
      <ion-segment-button value="A">
        <ion-label>A</ion-label>
      </ion-segment-button>
      <ion-segment-button value="B">
        <ion-label>B</ion-label>
      </ion-segment-button>
    </ion-segment>
<ion-content [ngSwitch]="type" scroll-y='true'>
<section *ngSwitchCase="A">
<!-- Content Here -->
</section>
<section *ngSwitchCase="B">
<!-- Content Here -->
</section>
</ion-content>

Posts: 1

Participants: 1

Read full topic

Rendering ion-grid for printer plugin

$
0
0

@sheikhm wrote:

i’m working with ionic printer plugin and rendering html(content) from ts, but it seems like only html native tags are working, can i use ionic tags like ion-grid?

Posts: 1

Participants: 1

Read full topic

Access Ionic animations data

$
0
0

@pabloo87 wrote:

Hi, i’m trying to modify ionic side menu animation adding a blur filter to the app when menu’s showed. In order to do so, i’m using a angular directive. I already made the desired effect except the transition duration as it change when the menu opens/closes and the platform is ios or Android.
The directive class is like this:

export class BlurMenuDirective {

  constructor(private el: ElementRef) {
    this.setBackdropFilter('None');
  }

  @HostListener('ionWillOpen') ionWillOpen() {
    this.setBackdropFilter('blur(2px)');
  }

  @HostListener('ionWillClose') ionWillClose() {
    this.setBackdropFilter('None');
  }

  setBackdropFilter(value) {
    this.el.nativeElement.style.backdropFilter = value;
  }
}

I’ve been an hour looking for an answer. Any ideas? It doesn’t matters if i have to hard code the timing to the class or i access programmatically to it.

Posts: 1

Participants: 1

Read full topic

Lazy Loading: Maximum Call Stack Size Exceeded

Amplify and Social Login (Federated) with Cognito pools

$
0
0

@codiqa100036932 wrote:

Hi

We have a app with amplify and ionic ( 5.4.9, below more info) . All works fine , s3, auth , analitycs , admin queries , auth .

But with auth and Federated Social Login we have problems with Android , on Web works fine.

We singup with Google Federated HostedUI on Cognito pools and auth works fine, but when can back to us we capture with deeplinks , and deeplinks trigger ok .

On next step when redirect from deeplinks to page for use , amplify detect SignIn with “A user Google_103030042694745594198 has been signed in” , that is ok.

But after that give us a error like this :

Failed to execute ‘replaceState’ on ‘History’: A history state object with URL 'com.movilgate.awslogin://app/auth/signin/'

We have an exception in this step and call Auth.currentAuthenticatedUser() , but we don’t know if that is ok , and is very ugly method .

Exists any example o technique for this works fine on android ?

ionic info :

Ionic:

Ionic CLI : 5.4.9 (/Users/mtoro/.ionic/Studio/Tools/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0

Cordova:

Cordova CLI : 9.0.3 (cordova-lib@9.0.2)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 5 other plugins)

Utility:

cordova-res : 0.6.0 (update available: 0.11.0)
native-run : 0.2.8 (update available: 1.0.0)

System:

NodeJS : v12.16.1 (/Users/mtoro/.nvm/versions/node/v12.16.1/bin/node)
npm : 6.13.4
OS : macOS Catalina
Xcode : Xcode 11.3.1 Build version 11C504

Posts: 1

Participants: 1

Read full topic

How to add an object to nested array in Ionic app?

$
0
0

@Sweg wrote:

In my Ionic 5 app, I am trying to push a Message object into an array located within a Conversation object.

Here are the models I’m using:

export class Conversation {
    constructor(
        public id: string,
        public userId: string,
        public mechanicId: string,
        public messages: Message[]
    ) { }
}

export class Message {
    constructor(
        public id: string,
        public text: string,
        public userId: string,
        public timestamp: Date
    ) { }
}

I am able to create a new Conversation with the below code:

addConversation(mechanicId: string, message: string) {
    const newConversation = new Conversation(
      Math.random().toString(),
      this.authService.userId,
      mechanicId,
      [this.createMessage(message)]
    );
    return this.conversations.pipe(
      take(1),
      delay(1000),
      tap(conversations => {
        this._conversations.next(conversations.concat(newConversation));
      }));
  }

  private createMessage(message: string): Message {
    return {
      id: Math.random().toString(),
      text: message,
      userId: this.authService.userId,
      timestamp: new Date(Date.now())
    };
  }

But I am trying to push a new Message object into an existing Conversation object below:

addToConversation(id: string, mechanicId: string, message: string) {
    const conversation = this.getConversation(id);
    if (conversation) {
      conversation.messages.push(
        this.createMessage(message)
      );
    }
  }

But I’m getting this console error:

Property ‘messages’ does not exist on type Observable<{ id: string, userId: string, mechanicId: string, messages: Message; }>

Can someone please tell me how I can add a new Message to an existing Conversation using this method?

Posts: 1

Participants: 1

Read full topic


not updating when trying to update items

$
0
0

@Sweg wrote:

In my Ionic 5 / Angular app, I am displaying some items in an <ion-virtual-scroll> below.

I am retrieving loadedMessages from a ConversationsService which I am calling from my Typescript you can see below also:

<ion-virtual-scroll [items]="loadedMessages">
    <ion-item-sliding *virtualItem="let message" #slidingItem>
        <ion-item>
            <ion-label>
                <h2>{{ message.text}}</h2>
            </ion-label>
        </ion-item>
    </ion-item-sliding>
</ion-virtual-scroll>

On the same page, I have the below form. When the user fills out this form, they add a new Message to the Conversation, they are able to do this using the conversation.id.

    <form [formGroup]="form">
        <ion-item>
            <ion-textarea formControlName="message"></ion-textarea>
        </ion-item>
        <ion-button (click)="onSendMessage()">Send</ion-button>
    </form>

Here is my Typescript:

ngOnInit() {
    this.route.paramMap.subscribe(paramMap => {
      this.conversationsSub = this.conversationsService
        .getConversation(paramMap.get('conversationId'))
        .subscribe(conversation => {
          this.conversation = conversation;
          this.loadedMessages = this.conversation.messages;
          this.mechanic = this.usersService.getUserByUserId(this.conversation.mechanicId);
          this.form = new FormGroup({
            message: new FormControl(null, {
              updateOn: 'blur',
            })
          });
        });
    });
  }
  onSendMessage() {
    this.conversationsService.addMessageToConversation(this.conversation.id, this.form.value.message);
  }

As I mentioned, if I navigate to a different page, & then navigate back to Conversation-Detail, the <ion-virtual-scroll> shows the updated messages, but I want the scroll to update as soon as the user clicks the Send button, & the Message is added.

And here is my ConversationsService:

export class ConversationsService {

  private _conversations = new BehaviorSubject<Conversation[]>([
    new Conversation(
      'conversation1',
      'user3',
      'user1',
      [
        new Message('message1', 'Test message', 'user3', new Date(2018, 0O5, 0O5, 17, 23, 42, 11)),
        new Message('message2', 'Another message', 'user1', new Date(2018, 0O6, 0O5, 17, 23, 42, 11))
      ]),
    new Conversation(
      'conversation2',
      'user4',
      'user2',
      [
        new Message('message3', 'my  message', 'user4', new Date(2018, 0O7, 0O7, 17, 23, 42, 11)),
        new Message('message4', 'more messages', 'user2', new Date(2018, 0O7, 0O7, 17, 23, 42, 11)),
      ])
  ]);

  get conversations() {
    return this._conversations.asObservable();
  }

  constructor(private authService: AuthService, private usersService: UsersService) { }

  private createMessage(message: string): Message {
    return {
      id: Math.random().toString(),
      text: message,
      userId: this.authService.userId,
      timestamp: new Date(Date.now())
    };
  }

  getConversation(id: string) {
    return this.conversations.pipe(
      take(1),
      map(conversations => {
        return { ...conversations.find(conversation => conversation.id === id) };
      }));
  }

  getConversationToAddMessage(id: string) {
    return this._conversations.getValue().find(conversation => conversation.id === id);
  }  

  addMessageToConversation(conversationId: string, message: string) {
    this.getConversationToAddMessage(conversationId).messages.push(this.createMessage(message));
  }

  addConversation(mechanicId: string, message: string) {
    const newConversation = new Conversation(
      Math.random().toString(),
      this.authService.userId,
      mechanicId,
      [this.createMessage(message)]
    );

    return this.conversations.pipe(
      take(1),
      delay(1000),
      tap(conversations => {
        this._conversations.next(conversations.concat(newConversation));
      }));
  }
}

Can someone please tell me how I can resolve this problem? I can provide further context if required also. Thanks a lot!

Posts: 1

Participants: 1

Read full topic

Error while build android in Ionic

$
0
0

@Sandeep776 wrote:

Hi,
i am trying to build my ionic app using the (Ionic cordova build android) but the occur every time while build android.
Error:-

strings.xml file :-

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">MyApp</string>
    <string name="launcher_name">@string/app_name</string>
    <string name="activity_name">@string/launcher_name</string>
    <string name="google_app_id">@string/google_app_id</string>
    <string name="google_api_key">@string/google_api_key</string>
</resources>

values.xml file:-

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="default_web_client_id" translatable="false">338850216501-l7679q2l5ft530fctce3ovjgc9o1r3me.apps.googleusercontent.com</string>
    <string name="firebase_database_url" translatable="false">https://bfit-gym.firebaseio.com</string>
    <string name="gcm_defaultSenderId" translatable="false">338850216501</string>
    <string name="google_api_key" translatable="false">"My Api Key"</string>
    <string name="google_app_id" translatable="false">"My Api id"</string>
    <string name="google_crash_reporting_api_key" translatable="false">AIzaSyBMmrqrdJ680nzHo_EbYWPWJhZf_f-P6Z8</string>
    <string name="google_storage_bucket" translatable="false">bfit-gym.appspot.com</string>
    <string name="project_id" translatable="false">bfit-gym</string>
</resources>

Posts: 1

Participants: 1

Read full topic

Random issue after navigating. Blank screen with class "ion-page-invisible"

$
0
0

@tkclark wrote:

Having issues which I’ve seen posted on here before but no real solution was given. Sometimes, not the majority of the time, I navigate to a page and it’s blank. I inspect the elements and everything is there, but ion-page has a class called ion-page-invisible on it. Not sure why?

I am using a tab based navigation system with a router. Any ideas what is happening? I see this in Chrome and in iOS.

Posts: 1

Participants: 1

Read full topic

Ion-router-outlet not working on sub-pages

$
0
0

@bmsantos wrote:

I’ve been trying to display the contents of a page on a sub ion-router-outlet but so far to no avail.

Sample project:
https://github.com/bmsantos/router-outlet-issue

The primary router-outlet is usually found in app.component.html and used to load the initial router contents:

<ion-app>
    <ion-router-outlet name="primary"></ion-router-outlet>
</ion-app>

In the sample app, you will find that the app.routing.module.ts will drive the app to a simulated login page. Once the user logs in, the app will route to members -> dashboard and place the new page in the primary router-outlet. The dashboard routing is defined in members-routing.module.ts.

app.routing.module.ts:

const routes: Routes = [
  {
    path: '',
    redirectTo: 'login',
    pathMatch: 'full',
  },
  {
    path: 'login',
    loadChildren: () => import('./pages/public/auth/login/login.module').then(m => m.LoginPageModule),
  },
  {
    path: 'members',
    canActivate: [AuthGuard],
    loadChildren: './members/member-routing/member-routing.module#MemberRoutingModule',
  }
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules, useHash: true})
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {
}

members-routing.module.ts:

const routes: Routes = [
  {
    path: 'dashboard',
    loadChildren: () => import('../../pages/dashboard/dashboard.module').then( m => m.DashboardPageModule),
  },
];

@NgModule({
  declarations: [],
  imports: [
    RouterModule.forChild(routes),
    CommonModule,
  ],
  exports: [
    RouterModule
  ]
})
export class MemberRoutingModule {
}

The dashboard page is just a ion-slipt-pane with a left menu and a secondary ion-router-outlet. The goal is to display the pages or components routed from the menu on the left into the secondary router-outlet.

<ion-content>
  <ion-split-pane contentId="pages-content">
    <ion-menu contentId="pages-content" type="overlay">
      <ion-content>
...
      </ion-content>
    </ion-menu>

    <ion-router-outlet id="pages-content" name="secondary"></ion-router-outlet>

  </ion-split-pane>
</ion-content>

The dashboard-routing.module.ts routes the requested page to be displayed in the secondary router-outlet and the page for folder/Add option is supposed to be rendered in the secondary outlet.

dashboard-routing.module.ts:

const routes: Routes = [
  {
    path: '',
    component: DashboardPage
  },
  {
    path: 'folder/Add',
    loadChildren: () => import('../../pages/add-event/add-event.module').then(m => m.AddEventPagePageModule),
    outlet: 'secondary'
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class DashboardPageRoutingModule {}

When the app is executed you can either trigger this option by clicking Trigger Link button or + Add option from the menu.

            <ion-button *ngIf="isFirst" expand="block"
                        [routerLink]="[{ outlets: { secondary: ['folder', 'Add']} }]"
                        routerDirection="forward"
            >Test Link</ion-button>

The resulting app link is properly generated and no error appear in the console:

http://localhost:8100/#/members/dashboard/(secondary:folder/Add)

The page is not loaded though and I’m not sure what I’m doing wrong or if this is a legit issue in Ionic 6.

Any idea, thanks

Posts: 1

Participants: 1

Read full topic

Ionic menu side bar automatic open

$
0
0

@AIBug wrote:

I’m looking at the ionic conference app example. When my internet browser reaches a certain width (about 3/4 of my screen) on my computer, the menu side bar opens automatically and remains open. I can’t find in the code what activates it and how to stop it. Anyone know how to stop it from opening?

Posts: 1

Participants: 1

Read full topic

Display LOCAL PDF in Ionic app

$
0
0

@YXUN wrote:

Hi guys, so I place my PDF folder in my src/assets folder and I am struggling to display it in my app.

I tried using

  • Iframe
  • Embed
  • Object

But none work. Any advice? Using Google Docs is not an option because I want users to be able to view PDF without access to the internet.

Thanks in advance for any help I can get.

Posts: 1

Participants: 1

Read full topic

Photo viewer plugin


Ionic Conference App Tab Icon Colors

$
0
0

@AIBug wrote:

I am working on the Ionic Conference app example and I’m trying to change the active tab colors, but no matter what i try from online, the active tabs remain blue and the inactive ones grey… i’m not sure why i can’t change them. Anyone have an idea?

Posts: 1

Participants: 1

Read full topic

Multiple selection in menu button

Video Youtube player error in IOS

$
0
0

@Lyhout wrote:

hi, guy, I got an issue with Video youtube player error in IOS. it 's not work at all.
Does anyone have a solution?

Posts: 1

Participants: 1

Read full topic

Android apk not beign updated

$
0
0

@jaiminpatel0210 wrote:

I am able to see the changes made in ionic application over the browser. But when i generate the android platform using(ionic cordova platform add android) and build to apk, it is not updated. It shows the older version.

Ionic:

Ionic CLI : 6.4.1 (C:\Users\lenovo\AppData\Roaming\nvm\v10.16.0\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 2.0.0
@capacitor/core : 2.0.0

Cordova:

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

Utility:

cordova-res : 0.11.0
native-run : 1.0.0

System:

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

Posts: 1

Participants: 1

Read full topic

Platform Styles and CDN help

$
0
0

@etarom wrote:

Hello
I can’t understand how Platform Styles work, in particular I tried to apply to an ionicv5 angular project with cordova

  <head>
    <meta charset="utf-8">
    <script type='text/javascript' src="core/dist/ionic.js"></script>
    <link rel="stylesheet" href="core/css/ionic.bundle.css">

but the result is very different from

<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css"/>

Ionic Framework CDN seem to provide great layout help on mobile platforms, can anyone give me some clarification?

thanks in advance,
Maurizio

Posts: 1

Participants: 1

Read full topic

Viewing all 49252 articles
Browse latest View live


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