Trying to use ion-tabs and ion-tab, I can't figure what I am missing
An I am surely missing something obvious to have this :
'ion-tab' is not a known element
My page.html is :
<ion-tabs>
<ion-tab tab="makuuchi">
<ion-header translucent>
<ion-toolbar>
<ion-title>Makuuchi</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen class="ion-padding">
<h1>Makuuchi</h1>
</ion-content>
</ion-tab>
<ion-tab-bar slot="top">
<ion-tab-button tab="makuuchi">
<ion-label>Makuuchi</ion-label>
<ion-icon name="people"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="juryo">
<ion-label>Juryo</ion-label>
<ion-icon name="people"></ion-icon>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
ion-tab-bar and ion-tabs are fine. The page is diplayed correctly once I remove ion-tab
My package.json's dependencies
"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"core-js": "^2.5.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.8.29"
},
Project was generated with ionic cli
Ionic:
Ionic CLI : 5.0.2 (/home/christophe/.nvm/versions/node/v8.10.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v8.10.0 (/home/christophe/.nvm/versions/node/v8.10.0/bin/node)
npm : 6.9.0
OS : Linux 4.18
My module.ts
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [RikishisPage]
})
export class RikishisPageModule {}
ion-tabs are found here : node_modules/@ionic/angular/dist/directives/navigation/ion-tabs.d.ts
ion-tab is not present
I am currently looking for a solution to force loading of ion-tab
Thanks for your help
try replacing ion-tab with ion-tab-bar, so your code will be as below.
source here
<ion-tabs>
<ion-tab-bar tab="makuuchi">
<ion-header translucent>
<ion-toolbar>
<ion-title>Makuuchi</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen class="ion-padding">
<h1>Makuuchi</h1>
</ion-content>
</ion-tab-bar>
<ion-tab-bar slot="top">
<ion-tab-button tab="makuuchi">
<ion-label>Makuuchi</ion-label>
<ion-icon name="people"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="juryo">
<ion-label>Juryo</ion-label>
<ion-icon name="people"></ion-icon>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
tested in local, view is being displayed and you should keep routing in place.
As per my understanding your question, I strongly believe that you are missing ionic module
inside your module. So I would suggest you add them.
@NgModule({
declarations: [
//add component declaration
],
imports: [
IonicModule //add ionic module here
]
})
I answer my own question : ion-tab doesn't exist in Typescript.
Sample code on the tabs ui component uses ion-tab only when in javascript !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With