javascript - $routeProvider not passing search parameter route -
i'm trying create toggle switches between 2 tables on 1 page. have both tables defined in index.html within <body ng-app="main"> tag as
<script type="text/ng-template" id="table1.html"> code </script> and
<script type="text/ng-template" id="table2.html"> code </script> my $routeprovider defined in .js as
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('!'); }]); ngroute been added dependency, controller has been defined , search parameter added url href surrounding each button in btn-group. supposed able click either button , switch table right happens when click buttons page refreshing , search parameter updating accordingly. know why $routeprovider doesn't seem routing .html?
solved including <div ng-view></div> before close tag related ng-app tag.
Comments
Post a Comment