I am facing a challenge in implementing *ngIF within the code of my Ionic4 project. I have come across some solutions, but none seem to be compatible with ionic 4
and angular 7
.
I attempted to import the imports: [CommonModule]
part, but unfortunately, it did not work at all.
Below is the snippet of the code I am using in the .html
file:
<ion-app>
<ion-split-pane>
<ion-menu>
<!-- Rest of the HTML code provided here -->
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
In addition, this is the code present in my .ts
file:
import {Component} from '@angular/core';
// Other imports mentioned here
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['main.scss'],
})
export class AppComponent {
// Constructor function and array declaration here
initializeApp() {
// Initialization code inside this function
}
authenticatedState() {
return this.authService.authenticated();
}
}
The issue arises when trying to utilize *ngIf which calls a function linked to a service returning either True
or False
.
The specific error message encountered reads as follows:
Can't bind to 'ngIF' since it isn't a known property of 'ion-item'