Posts

sidemenu refresh through events

create service ionic g service service name import {Injectable} from '@angular/core'; import {Subject} from 'rxjs'; @Injectable({     providedIn: 'root' }) export class GlobalFooService {     private fooSubject = new Subject<any>();     publishSomeData(data: any) {         this.fooSubject.next(data);     }     getObservable(): Subject<any> {         return this.fooSubject;     } } Now, you can subscribe in any component like app.component.ts: @Component({     selector: 'app-root',     templateUrl: 'app.component.html',     styleUrls: ['app.component.scss'] }) export class AppComponent {     constructor(private globalFooService: GlobalFooService) {         this.initializeApp();     }     initializeApp() {         // other code         this.globalFooService.get...

escape-single-quote-character-for-use-in-an-sqlite-query

String mystring = "Sample's"; String myfinalstring = mystring.replace("'","''");

multilanguage conversion in ionic4

https://www.freakyjolly.com/ionic-4-adding-multi-language-translation-feature-in-ionic-application-using-ngx-translate/#.XrKPQJ77TIU

how to add accordian to ionic project

<ion-list>     <div class="input1001" *ngFor="let d of diseases; let i=index" text-wrap (click)="toggleGroup(i)" [ngClass]="{active: isGroupShown(i)}">     <ion-row style="border-radius: 5px;padding-top: 2px;box-shadow:2px 2px 2px 2px #e6e6e6">       <ion-col size="11" style="    padding-left: 5px; font-size:12px       ">         {{d.title}}       </ion-col>       <ion-col size="1" style="text-align: right;padding-right: 10px;">         <ion-icon name="chevron-down-outline" *ngIf="!isGroupShown(i)"></ion-icon>         <ion-icon  name="chevron-up-outline" *ngIf="isGroupShown(i)"></ion-icon>       </ion-col>     </ion-row>     <div style="height:1px;box-shadow: 1px 1px 1px 1px #F0F0F0 ">     </div>   ...

ionic5 push notifications

ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID="*********" npm install @ionic-native/push in config.xml <resource-file src = "google-services.json" target = "app/google-services.json" /> in app.module.ts import { Push } from '@ionic-native/push/ngx' ; in providers add-->push in app.component.ts import { Push , PushObject , PushOptions } from '@ionic-native/push/ngx' ; private push : Push ,-->in constructor ngOnInit(){ this.pushnotification (); } pushnotification (){ this . push . hasPermission () . then (( res : any ) => { if ( res . isEnabled ) { console . log ( 'We have permission to send push notifications' ); this . sendmsg (); } else { console . log ( 'We do not have permission to send push notifications' ); } }); } sendmsg (){ const options : PushOptions = { android ...

send data in navigation using ionic5

https://ionicacademy.com/pass-data-angular-router-ionic-4/ send page: import { Router , NavigationExtras } from '@angular/router' ; let paymentDetails = { amount : this . ElectricityForm . value . Amount , provider_code : this . providercode , connection_provider : this . ElectricityForm . value . SelectBoard , account_number : this . ElectricityForm . value . ConsumerNO , bill_type : "payment" , type : "electric" , selectstate : this . ElectricityForm . value . SelectState , statecode : this . statecode } let navigationExtras : NavigationExtras = { queryParams : { special : JSON . stringify ( paymentDetails ) } }; this . router . navigate ([ "/paybillpayment-options" ], navigationExtras ) receive page:: import { ActivatedRoute , Router } from '@angular/router' ; construct...

ionic page scroll to bottom example

import { Content } from 'ionic-angular'; //ionic3 @ViewChild(Content) content: Content; // ionic3  import { Content } from '@angular/compiler/src/render3/r3_ast'; //ionic5 @ViewChild(Content, {static: true}) content: Content;  //ionic5 scrollToBottom() {     setTimeout(() => {       this.content.scrollToBottom();     }, 100);   }