Angularjs 带搜索查询的角度路由
有人知道如何在Angular中使用搜索查询进行路由吗?我曾尝试使用Angularjs 带搜索查询的角度路由,angularjs,html,routing,Angularjs,Html,Routing,有人知道如何在Angular中使用搜索查询进行路由吗?我曾尝试使用$routeProvider,但它不适用于搜索查询 这是我用$routeProvider编写的路由代码: app.config(['$routeProvider', function ($routeProvider){ $routeProvider.when('/?table=table1', { controller:'PostsCtrl', templateUrl: 'table1.html' }) $rou
$routeProvider
,但它不适用于搜索查询
这是我用$routeProvider
编写的路由代码:
app.config(['$routeProvider', function ($routeProvider){
$routeProvider.when('/?table=table1', {
controller:'PostsCtrl',
templateUrl: 'table1.html'
})
$routeProvider.when('/?table=table2', {
controller: 'PostsCtrl',
templateUrl: 'table2.html'
})
$routeProvider.otherwise({redirectTo: '/?table=table1'});
}]);
app.config(['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true).hashPrefix('!');
}]);
以及他们所指的模板:
<script type="text/ng-template" id="table1.html">
some code
</script>
一些代码
及
一些代码
您能分享代码吗please@DebasishMohapatra我将添加我使用$routeProvider
编写的路由代码。您可以发现此链接非常有用:
<script type="text/ng-template" id="table2.html">
some code
</script>