Introduced
Ion-tabs is the tab component in Ionic, and the route uses Angular-ui-router.js. So we must master Uiroute first.
Effect chart
Instance Code
Index.html
<body ng-app= "starter" >
<!--ion-nav-view used to render templates-->
<ion-nav-view></ion-nav-view>
</body>
Tab-index.html
<ion-tabs class= "Tabs-icon-only tabs-icon-top" >
<!--href: tab corresponding status Icon-on:ion-tab not highlighted icon Icon-off: Ion-tab Highlight icon-->
<ion-tab title= "Home" href= "#/tabs/home" icon-on= "Ion-new-home-off" icon-off= "Ion-new-home" >
<!--have multiple ion-nav-view in the same state, so you need to set the Name property for them. and the corresponding state and render view when the routing is configured-->
<ion-nav-view name= "Tab-home" ></ion-nav-view>
</ion-tab>
<ion-tab title= "Taobao" 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 title= "Good goods" Icon-off = "Ion-new-zhemai" icon-on= "Ion-new-zhemai-off" >
</ion-tab>
<ion-tab title= "My 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 "}}
)
You can then write the contents of each tab under Home.html taobao.html user.html
For example:
Home.html
<ion-header-bar class= "Bar bar-header assertive-bg bar-home" >
<ion-title> Home </ion-title>
</ion-header-bar>
<ion-view>
<ion-content>
<ion-refresher pulling-text= "pull down Refresh" On-refresh= "Dorefresh ()" ></ion-refresher>
</ion-content>
</ion-view>
Note: Do not place ion-tabs in a ion-content element; it can cause a certain known CSS error.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.