I’m trying to use the ionic-tooltips module with Ionic v4. The module was installed with npm.
Creating a new blank project and following the installation steps from the module site I got some problems. First with some missing components that I was able to fix manually changing the imports of some files, just like in this question.
After that I got this other error:
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("
<div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Can't bind to 'ngIfElse' since it isn't a known property of 'div'. ("
<div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
[ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4
Property binding ngIfElse not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
[ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4
Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("
<div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Can't bind to 'ngIfElse' since it isn't a known property of 'div'. ("
<div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
[ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
<ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4
After some searching I got some awnsers that converged to the same solution: Import Ionic CommonModule to your main Module. I did this, no success.
My home.page.html:
<ion-content>
<ion-button tooltip="I'm a tooltip below a button" positionV="bottom" arrow>
Press me to see a tooltip
</ion-button>
</ion-content>
home.module.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HomePage } from './home.page';
import { TooltipsModule } from 'ionic-tooltips';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild([
{
path: '',
component: HomePage
}
]),
TooltipsModule.forRoot()
],
declarations: [HomePage]
})
export class HomePageModule {}
app.module.ts (where I lastly tried to import CommonModule):
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, BrowserAnimationsModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
If there is any missing info, please ask.