Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 带搜索查询的角度路由_Angularjs_Html_Routing - Fatal编程技术网

Angularjs 带搜索查询的角度路由

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

有人知道如何在Angular中使用搜索查询进行路由吗?我曾尝试使用
$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>