introduce
ion-tabs is a tab component in ionic, and the routing uses angular-ui-router.js. Therefore, you must first master uiRoute.
Reproduction diagram
Example code
index.html
<body ng-app="starter"> <!--ion-nav-view is used to render templates--> <ion-nav-view></ion-nav-view></body>
tab-index.html
<ion-tabs> <!--href: The status corresponding to the tab icon-on:ion-tab non-highlight icon icon-off:ion-tab highlight icon--> <ion-tab href="#/tabs/home" icon-on="ion-new-home-off" icon-off="ion-new-home"> <!--There are multiple ion-nav-views in the same state, so they need to be set to the name attribute. And when formulating routes, corresponding status and rendering views --> <ion-nav-view name="tab-home"></ion-nav-view> </ion-tab> <ion-tab href="#/tabs/taobao" icon-off="ion-new-tf" icon-on="ion-new-tf-off"> <ion-nav-view name="tab-taobao"></ion-nav-view> </ion-tab> <ion-tab icon-off="ion-new-zhemai" icon-on="ion-new-zhemai-off"> </ion-tab> <ion-tab href="#/tabs/user" icon-off="ion-new-user" icon-on="ion-new-user-off"> <ion-nav-view name="tab-user"></ion-nav-view> </ion-tab></ion-tabs>
config.js
.state("tabs", { url: "/tabs", templateUrl : "templates/tab/tab-index.html", controller : "tabs"}).state("tabs.home", { url: "/home", views : { "tab-home" : { templateUrl : "templates/home/home.html" } }}).state("tabs.taobao", { url: "/taobao", views : { "tab-taobao" : { templateUrl : "templates/taobao/taobao.html" } }}).state("tabs.user", { url: "/user", views : { "tab-user" : { templateUrl: "templates/user/user.html" } }})Then you can write the contents of each tab under home.html taobao.html user.html
For example:
home.html
<ion-header-bar> <ion-title>Home</ion-title></ion-header-bar><ion-view> <ion-content> <ion-refresher pulling-text="drop-down refresh" on-refresh="doRefresh()"></ion-refresher> </ion-content></ion-view>
Note: Do not place ion-tabs into an ion-content element; it will cause certain known CSS errors.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.