这是一个奇怪的问题,当我设置了HTML5MODEL之后,无法正常访问页面
第一步 设置HTML
或者
第二步 开启HTML5MODEL
$locationProvider.html5Mode(true);
第三步 设置apache .htaccess
RewriteEngine On
RewriteBase /test/ionic/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /test/ionic/index.html [L]
设置完成后,刷新首页,能够正常访问首页
但是在点击 ion-tabs 里面的其他任何链接的时候,就无任何反应
如下代码运行后具体步骤为:
直接访问首页 app/home ,正常
点击 about ,无任何反应
直接访问 app/about ,也正常
值得说明的是,如果不用ionic,那么就可以完全正常的访问任何一个链接
完整的代码
Tabs ExampleBanging your head against a wall uses 150 calories an hour.
Dogs have four toes on their hind feet, and five on their front feet.
The ant can lift 50 times its own weight, can pull 30 times its own weight and always falls over on its right side when intoxicated.
A cockroach will live nine days without it's head, before it starves to death.
Polar bears are left handed.
111,111,111 x 111,111,111 = 12,345,678,987,654,321
1 in every 4 Americans has appeared on T.V.
11% of the world is left-handed.
1 in 8 Americans has worked at a McDonalds restaurant.
$283,200 is the absolute highest amount of money you can win on Jeopardy.
101 Dalmatians, Peter Pan, Lady and the Tramp, and Mulan are the only Disney cartoons where both parents are present and don't die throughout the movie.
Create hybrid mobile apps with the web technologies you love.
Free and open source, Ionic offers a library of mobile-optimized HTML, CSS and JS components for building highly interactive apps.
Built with Sass and optimized for AngularJS.
@IonicFramework
@DriftyTeam
angular.module('ionicApp', ['ionic'])
.config(function($stateProvider, $urlRouterProvider,$ionicConfigProvider,$locationProvider) {
$locationProvider.html5Mode(true);
$ionicConfigProvider.platform.ios.tabs.style('standard');
$ionicConfigProvider.platform.ios.tabs.position('bottom');
$ionicConfigProvider.platform.android.tabs.style('standard');
$ionicConfigProvider.platform.android.tabs.position('standard');
$ionicConfigProvider.platform.ios.navBar.alignTitle('center');
$ionicConfigProvider.platform.android.navBar.alignTitle('left');
$ionicConfigProvider.platform.ios.backButton.previousTitleText('').icon('ion-ios-arrow-thin-left');
$ionicConfigProvider.platform.android.backButton.previousTitleText('').icon('ion-android-arrow-back');
$ionicConfigProvider.platform.ios.views.transition('ios');
$ionicConfigProvider.platform.android.views.transition('android');
$stateProvider
.state('app', {
url: "/app",
abstract: true,
templateUrl: "templates/tabs.html"
})
.state('app.home', {
url: "/home",
views: {
'home-tab': {
templateUrl: "templates/home.html",
controller: 'HomeTabCtrl'
}
}
})
.state('app.facts', {
url: "/facts",
views: {
'home-tab': {
templateUrl: "templates/facts.html"
}
}
})
.state('app.facts2', {
url: "/facts2",
views: {
'home-tab': {
templateUrl: "templates/facts2.html"
}
}
})
.state('app.about', {
url: "/about",
views: {
'about-tab': {
templateUrl: "templates/about.html"
}
}
})
.state('app.navstack', {
url: "/navstack",
views: {
'about-tab': {
templateUrl: "templates/nav-stack.html"
}
}
})
.state('app.contact', {
url: "/contact",
views: {
'contact-tab': {
templateUrl: "templates/contact.html"
}
}
});
$urlRouterProvider.otherwise("/app/home");
})
.controller('HomeTabCtrl', function($scope) {
console.log('HomeTabCtrl');
});