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

Can i call LifeCycle methods in Refresh function

$
0
0

Not sure if I understood well… Your updated values aren’t getting reflected on template? In that case can you confirm that they get updated indeed (console log them after update)?

Just wondering why do you use setTimeouts here?


Run Ionic 4 project on another computer

$
0
0

what do you mean by “removed all from TEMP folder”?

iOS caches splash screen resources

$
0
0

@apamphilon unfortunately no… I am thinking to write Apple about this. Do you maybe have any progress so far with this? Or any other member?
Thanks for help :slight_smile:

Ionic Capacitor on older ios devices

$
0
0

So I am trying to build a basic Capacitor application onto a iOS device. The device is a 1st gen iPad Mini which runs iOS 9.3.5 and apple won’t update it further.

When trying to build in xcode 11 the following error appears;

Could not find module ‘Capacitor’ for target ‘armv7-apple-ios’; found: arm64, arm64-apple-ios

The target ios is set to 9.3 but the error still appears.

Is it possible to build Capacitor applications for armv7 architectures?

FCM Notification not showing when app killed on some devices

$
0
0

I am working with ionic 3,

Some of devices not receiving FCM notifications when the app is killed on Android.
Mostly common devices are Oppo, Vivo and Xiaomi.

I’ve tested two plugin

and

Ionic ion-range events all Custom-Events?

$
0
0

Hey there,
I use ionic (@ionic/angular 4.11.10) in a bigger project and there is some strange Event-Thing going on on the “ion-range”.

I started a new blank projekt (ionic starter tabs) and there is the same thing going on. I am not sure if it is just normal now, or if it is some kind of a bug.

I like to use that ion-range in combination with an audio-player and the user should use it as a seekbar. So far so good.

No matter which event I use. I always get back a “CustomEvent”.

Template:
<ion-range (ionChange)="change($event)"></ion-range>

and ts-file:
change(value) {
console.log(value);
}

and log shows:

1. CustomEvent {isTrusted: false, detail: {…}, type: "ionChange", target: ion-range.md.hydrated.range-pressed, currentTarget: ion-range.md.hydrated.range-pressed, …}

  1. isTrusted: false
  2. detail: {value: 66}
  3. type: "ionChange"
  4. target: ion-range.md.hydrated
  5. currentTarget: null
  6. eventPhase: 0
  7. bubbles: true
  8. cancelable: true
  9. defaultPrevented: false
  10. composed: true
  11. timeStamp: 9909.179999958724
  12. srcElement: ion-range.md.hydrated
  13. returnValue: true
  14. cancelBubble: false
  15. path: (21) [ion-range.md.hydrated, slot, main.inner-scroll.scroll-y, document-fragment, ion-content.md.hydrated, app-tab2.ion-page, slot, document-fragment, ion-router-outlet.hydrated, div.tabs-inner, ion-tabs, app-tabs.ion-page, slot, document-fragment, ion-router-outlet.hydrated, ion-app.md.ion-page.hydrated, app-root, body, html.plt-desktop.md.hydrated, document, Window]
  16. __proto__: CustomEvent

So can anybody tell me if that is normal? In older versions there have been much more options, like “_isFocus” and stuff.

The thing is when I ise the ionBlur or ionFocus event i do not get the value the user clicked on because details is just empty with no value.

The old event looks like this one here:

1. Range {_config: Config, _elementRef: ElementRef, _renderer: RendererAdapter, _componentName: "range", _mode: "md", …}

  1. min: (...)
  2. max: (...)
  3. step: (...)
  4. snaps: (...)
  5. pin: (...)
  6. debounce: (...)
  7. dualKnobs: (...)
  8. ratio: (...)
  9. ratioUpper: (...)
  10. disabled: (...)
  11. value: (...)
  12. color: (...)
  13. mode: (...)
  14. _config: Config {_c: {…}, _s: {…}, _modes: {…}, _trns: {…}, plt: Platform}
  15. _elementRef: ElementRef {nativeElement: ion-range.range.range-md.range-md-white.ng-valid.ng-dirty.ng-touched}
  16. _renderer: RendererAdapter {delegate: DebugRenderer2}
  17. _componentName: "range"
  18. _mode: "md"
  19. _defaultValue: 0
  20. _form: Form {_focused: null, _ids: 35, _inputs: Array(1)}
  21. _item: Item {_config: Config, _elementRef: ElementRef, _renderer: RendererAdapter, _componentName: "item", _mode: "md", …}
  22. _ngControl: null
  23. _isFocus: false
  24. _disabled: false
  25. _debouncer: TimeoutDebouncer {wait: 0, timer: null, callback: ƒ}
  26. _init: true
  27. _initModel: true
  28. ionFocus: EventEmitter {_isScalar: false, observers: Array(0), closed: false, isStopped: false, hasError: false, …}
  29. ionChange: EventEmitter {_isScalar: false, observers: Array(1), closed: false, isStopped: false, hasError: false, …}
  30. ionBlur: EventEmitter {_isScalar: false, observers: Array(0), closed: false, isStopped: false, hasError: false, …}
  31. _value: 26
  32. id: "range-15-0"
  33. _labelId: "lbl-15"
  34. _haptic: Haptic {_p: undefined}
  35. _plt: Platform {_versions: {…}, _qp: QueryParams, _bbActions: Array(1), _pW: 0, _pH: 0, …}
  36. _dom: DomController {plt: Platform, r: Array(0), w: Array(0), q: false}
  37. _cd: ViewRef_ {_view: {…}, _viewContainerRef: null, _appRef: null}
  38. _min: 0
  39. _max: 93
  40. _step: 1
  41. _valA: 26
  42. _valB: 0
  43. _ratioA: 0.27956989247311825
  44. _ratioB: 0
  45. _events: UIEventManager {plt: Platform, evts: Array(1)}
  46. _slider: ElementRef {nativeElement: div.range-slider}
  47. _color: "white"
  48. _barL: ""
  49. _barR: "72.04301075268818%"
  50. _onChanged: ƒ (newValue)
  51. _onTouched: ƒ ()
  52. _rect: DOMRect {x: 95.234375, y: 391.234375, width: 243, height: 42, top: 391.234375, …}
  53. _activeB: undefined
  54. _pressed: false
  55. _pressedA: false
  56. _pressedB: false
  57. __proto__: BaseInput

Is that a bug or now just normal? Thanks for the help so far. :slight_smile:

FCM Notification not showing when app killed on some devices

$
0
0

Did you check with the onNotification method? and inside the onNotification wasTapped or not?.
If you are not able to get any push notifications
try following:

  • Check are you registering your device with the corresponding server(backend).
  • Once if it is registering successfully then check if the backend sending the push msg to the device registered…

FCM Notification not showing when app killed on some devices

$
0
0

I’ve get the particular device token registered with my app. when app is on foreground the notification will show in notification bar but when you remove the app from background then the app didn’t get any notification on notification bar.


FCM Notification not showing when app killed on some devices

iOS Device Debugging

$
0
0

That’s the problem, I have no source .ts files available through Safari :confused:

Ionic serve failing to run

$
0
0

Hie guys,

I’m a newbie to ionic. I’ve just bought a ionic template which is version 3.3.0-beta7 and my ionic version which is installed is version 3.3.0.
What happens is if i run ionic serve or ionic info i get the following prompt below:

Looks like this is an angular project, would you like to install @ionic/cli-plugin-angular and continue? (Y/n)
The challenge is when i say “Yes” it either hangs or throws the error message below.

Please help

Ionic 4 ios build constuctor not calling in app and splash screen not hidding

$
0
0

hi developers,

my issue on mac ios build in my app not contructor call and not even installize the app
in android it work properly .

In ios build when installed the build from xcode it open and showing splash screen laoding and loading not moving inside the application.

please help me out developer
thanku in advance ,

FCM Notification not showing when app killed on some devices

[Ionic 4] ion-select and change detection

$
0
0

I faced the same issue in Ionic 4, my use-case is, I need to remove an option bases on a condition
. For that i have deleted the entire ion-select and created the new one. That helped me

[Ionic 4] ion-select and change detection


How to set auto height for ifram in ionic

$
0
0

‘<iframe width=“100%” height=“100%” [src]=“url” frameborder=“0” allowfullscreen data-tap-disabled=“false” >’

Ionic 3: Deeplinking

$
0
0

Hello everyone, any Deeplinks implement with Ionic 3 on iOS? I’m trying to make it work and I can’t.

Use the plugins:
cordova plugin add ionic-plugin-deeplinks and cordova plugin add cordova-plugin-customurlscheme but none worked successfully.

If you can help me with this issue, it would be great. If you have any tutorials, you will be grateful.

Regards and thank you very much
Nicolas

How to set auto height for ifram in ionic

$
0
0

Be careful maybe what is happening is that ion-content is not 100% width. You need to set all items above iframe to 100%.

Regards.

Ionic 4 pass data back from modal which is opened inside another modal to base page

$
0
0

I am opening a modal on-base page called home.page.ts. On this modal 1, another modal is opened on a button click. Now I want to send data back from 2nd modal to base page called ‘home.page.ts’

Currently

  1. I am getting data back from l(first modal) to home page
  2. I am getting data from (second modal) to (first modal)

But I want to get data directly from 2nd modal to base page

I am sending data back using a modal dismiss event. And 2nd modal’s dismiss event function is written on (first modal) page. Now, How can I access this data at the base page which is home.page.ts

Note: All these modals are lazy loaded Which means modal1’s module is added in the imports of base page’s module and modal2’s module is added in the imports of modal1’s module

here is my code
home.page.ts

import { ModalController } from '@ionic/angular';
import { AddressPage } from '../pages/address/address.page';

 constructor(public modalController: ModalController) {}


  async address_modal(){
    // console.log("clicked")
     const modal = await this.modalController.create({
       component: AddressPage,

     });

     modal.onDidDismiss()
     .then((data) => {
       const user = data['data']; // Here's your selected user!
       console.log("from address "  + user)

   });

     return await modal.present();
   }
}

home.page.html

  <ion-button (click) = "address_modal()">address</ion-button> // to open first modal

address.page.ts // first modal

 x:any;

  constructor(private modalController: ModalController) { 
   this.x =2;
  }

close(){
    this.modalController.dismiss(this.x)
  }


    async add_address(){


      // console.log("clicked")
       const modal = await this.modalController.create({
         component: AddAddressPage,

       });
       modal.onDidDismiss()
       .then((data) => {
         const user = data['data']; // Here's your selected user!
         console.log( "from add-adreess"  + user)

     });

       return await modal.present();
     }

address.html

<ion-button (click)="close()">close</ion-button> // close modal
<ion-button (click)="add_address()">open</ion-button> // open second modal

add-address.page.ts // second modal

import { ModalController } from '@ionic/angular';

 x:any;
  constructor(private modalController: ModalController) {
    this.x =5;
   }


  close(){
    this.modalController.dismiss(this.x)
  }

add-address.html

  <ion-button (click) ="close()">close</ion-button >

Can i call LifeCycle methods in Refresh function

$
0
0

we are using asynchronous calls to the function that is the reason why we used setTimeout.

how can i call lifecycle methods manually in a refresh function ??

Here is the complete code if you want a brief understanding go through it

export class FollowersPage implements OnInit {

  follow: any = [];
  tasks: any = []; // followers array
  following: any = [];
  stats: any = [];
  isfollowing:any=[];
  hasfollowers:Boolean;
  hasfollowing:Boolean;
  nofollowers:Boolean;
  nofollowing:Boolean;
  

  constructor(public router: Router,
    public afAuth: AngularFireAuth,
    public store: AngularFireStorage,
    public data: AngularFireDatabase, ) { }

  ngOnInit() {   }

  ionViewWillEnter() {
    this.followers();
    this.getuserfollowing();
    setTimeout(() => {
      if (this.hasfollowers == true && this.hasfollowing == true) {
        this.getstats();
      }
      console.log(this.hasfollowing);
    console.log(this.hasfollowers);   
    }, 1000);
  }
 
  
 async  getuserfollowing(){
    const user = this.afAuth.auth.currentUser.uid;
    const dbref = this.data.database.ref('/following/');
    const snap = await dbref.once('value');           
    if (snap.child(user).exists()) {
      const notify = snap.child(user).val();
             this.following = (Object.values(notify)).reverse();
     console.log('following');
      console.log(this.following);
      this.hasfollowing=this.following.length!=0?true:false;
      console.log(this.hasfollowing);
    }
  }

  getstats() {
    console.log('getstats');
    let taskid = [];
    let folowingid = [];
    this.tasks.map(task => {
      taskid.push(task.id);
    });
    this.following.map(foll => {
      folowingid.push(foll.id)
    });
    taskid.map(task => {
      const test = (folowingid.includes(task));
      this.isfollowing.push(test);
    });
    console.log(this.isfollowing);
  }

  goBack() {
    this.router.navigate(['/profile'], { replaceUrl: true });
  }

  followers() {
    const databaseref = this.data.database.ref('/followers/' + this.afAuth.auth.currentUser.uid);
    databaseref.once("value", (snapshot) => {
      snapshot.forEach(child => {
        let values = (child.val());
        this.follow.push(values);
        console.log(this.follow);
        this.tasks = this.follow;
        console.log(this.tasks.length);
       this.hasfollowers=this.tasks.length!=0? true:false;
       console.log(this.hasfollowers);
       
      })
    })
  }

  async remove(i) {
    try {
      let user = this.afAuth.auth.currentUser.uid;
      let followerref = this.data.database.ref('/followers/' + user);
      const followerstats = await followerref.child(i).remove();
      let followingref=this.data.database.ref('/following/'+i);
      const followingstats=await followingref.child(user).remove();
      this.goBack();
    } catch (error) {
      console.log(error);
    }
  }

  async followback(i){
    console.log("followback");
    let reference1 = this.data.database.ref('/following/' + this.afAuth.auth.currentUser.uid);
    console.log(reference1);
    let followerid = i;
    let followingid = this.afAuth.auth.currentUser.uid;
    this.getuserdetails(followerid, 'following', followingid);
    this.getuserdetails(followingid, 'followers', followerid);
  }


  getuserdetails(id, node, nodeid) {
    let user = id;
    let name;
    let dbref = this.data.database.ref('/users/' + user);
    console.log(dbref);
    dbref.once('value', snap => {
      name = snap.val().fullname;
      console.log(name);
      let dataref = this.data.database.ref();
      let noderef = dataref.child('/' + node + '/' + nodeid + '/' + id)
      noderef.set({
        id: id,
        name: name,
      })
    })
  }


  doRefresh(event) {
    console.log('Begin async operation');
    this.goBack();  
    setTimeout(() => {
      console.log('Async operation has ended');
      event.target.complete();
    }, 2000);
  }
}

Viewing all 228491 articles
Browse latest View live


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