Cannot add modal to my code

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;
})

2024-02-15 17_29_28-● tab1.page.ts - baustelle - Visual Studio Code

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.

This code solved it for me.

import { ModalController } from '@ionic/angular';
constructor(private modalCtrl: ModalController) {}