*ngIf not working in ng-container element


I’m starting a new project and am having a problem. I’ve added a new page and in the html template I want to use ng-container element with ngIf. To test this, I’ve listening to the ActiveRoute’s paramMap observable. I log to the console if a route parameter ( :id ) exists or not, then set a property to true or false.

Within the development environment, the console.log is correctly pointing out whether or not a route parameter returns true or false, however the next error is 'Can’t bind to ‘ngIf’ since it isn’t a known property of ‘ng-container’ and nothing is rendered to the browser.

I’ve searched online if anyone had this issue with Ionic. Which I did not find one.

Bit of history:
In my environment, Ionic installed angular@13, which I thought was weird that the cli is supported to angular 12. To be totally sure, I use nvm to install node 14.18.0 and installed the angular/cli/@12 globally and then ionic. Ionic again, installed angular@13 into the project. Isn’t this weird?

I decided to test ng-container within the default app.component.html and it worked. I looked at the differences between the default module and the new page’s module and only the browsermodule was lacking in the new page. I added it and it made no difference in the error, while it continued to work in app.component.html module.

Next I created a component and added to the new page’s module and put the into the page.html thinking its a regular angular component and it still doesn’t work.

I’m at a lost as to what else to do here. Why is it not working? Has anyone run into this?


I assume this was a test with ngIf? ngIf should work with ng-container (at least it does in my projects) and when structural angular directives give these type of errors, typically I have made a mistake with module inclusion. E.g. when a page is a modal it is easy to make a mistake.

The module declatation for my page looks like this:


  imports: [






  declarations: [PrelaunchPage]


I think the CommonModule is the one needed - as it exports the required directives

And indeed, when I remove CommonModule, I get the error on unknown property.