我无法弄清楚为什么会出现这种情况。每次我尝试通过单击锚点来加载新位置时,它都会重定向到根位置。我正在子目录 http://localhost/myapp/ 中构建我的应用。请看下面的代码。 这是HTML代码:
<ul class="nav navbar-nav navbar-right">
<li><a href="!#/">Home</a></li>
<li><a href="!#/insertLeaveDetails">Insert Leave</a></li>
<li><a href="!#/currentYearDetails">Current Year</a></li>
</li>
</ul>
这是脚本:
var app = angular.module('leaveApp',['ngRoute']);
app.config(['$routeProvider',function($routeProvider){
$routeProvider
.when('/',{
templateUrl : 'templates/temp.php',
controller : 'homeCtrl'
})
.when('/insertLeaveDetails',{
templateUrl : 'templates/temp.php',
controller : 'insertLeaveDetailsCtrl'
})
.when('/currentYearDetails',{
templateUrl : 'templates/temp.php',
controller : 'currentYearDetailsCtrl'
})
.otherwise({
redirectTo: '/'
});
}]);
app.controller('homeCtrl',['$scope',function($scope){
console.log('home ctrl');
$scope.msg = 'This is home ctrl';
}]);
app.controller('insertLeaveDetailsCtrl',['$scope',function($scope){
console.log('insert ctrl');
$scope.msg = 'This is leave ctrl';
}]);
app.controller('currentYearDetailsCtrl',['$scope',function($scope){
console.log('current deatail ctrl');
$scope.msg = 'This is current year ctrl';
}]);
答案 0 :(得分:1)
<?php echo $row['floorid'];?>
的默认值为“!”。这意味着,除非您更改提供者值,否则您的链接应该类似于
$locationProvider.hashPrefix