我是离子新手,我正在开发基于标签的应用。当应用程序第一次加载时,标签处于活动状态,当点击User Account
链接时,它会将您带到一个没有标签的页面,当您返回到主页时主页标签消失了。
同时我只将hide-tabs
课程应用于一页
JS
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services','ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
//mother tabs persistant on all pages that is the tabs
.config(function($stateProvider, $urlRouterProvider,$ionicConfigProvider){
$ionicConfigProvider.tabs.position("standard");
$ionicConfigProvider.tabs.style("standard");
$stateProvider
.state('tabs',{
url: '/tab',
abstract:true,
templateUrl:'templates/index_tabs.html',
})
.state('tabs.index',{
url:'/index',
views:{
'list-index':{
templateUrl: 'templates/index_files/index.html',
}
}
})
.state('tabs.useracc',{
url:'/useracc',
views:{
'list-useracc':{
templateUrl: 'templates/index_files/useracc.html',
}
}
})
.directive('hideTabs', function($rootScope) {
return {
restrict: 'A',
link: function($scope, $el) {
$rootScope.hideTabs = true;
$scope.$on('$destroy', function() {
$rootScope.hideTabs = false;
});
}
};
});
HTML
<ion-list>
<ion-item class="item-thumbnail-left item-text-wrap" data-ng-controller="line_modal" ng-click="line_modal()">
<img src="img/index/social.png" alt="photo" width="64" height="64" />
<h2>User Account</h2>
<p>To have access to your line details, simply tap on the "3 bars" at the top right of your screen to access your line details </p>
</ion-item>
</ion-view>
突片
<ion-tab icon="ion-home" title="Home" href="#/tab/index">
<ion-nav-view name="list-index"></ion-nav-view>
</ion-tab>
<ion-tab icon="ion-log-in" title="User Account" href="#/tab/login">
<ion-nav-view name="list-login"></ion-nav-view>
</ion-tab>
</ion-tabs>