cherry
1
Hello, I am trying to add modal to my App but it doesn’t recognize the code.
My code:
import { Component, ViewChild } from ‘@angular/core’;
import { IonModal } from ‘@ionic/angular’;
export class Tab1Page {
@ViewChild(IonModal) modal: IonModal;
})

This code was taken out of the Ionic UI Components Guide.
What am I missing here?
You shouldn’t be using viewChild. Scroll up to the top of the link you provided. It shows multiple different ways to implement a ion modal.
cherry
3
This code solved it for me.
import { ModalController } from '@ionic/angular';
constructor(private modalCtrl: ModalController) {}
1 Like