javascript - Handle Query string in routeprovider or any other solution (Help me plz) -


how handle query string (index.php?comment=hello) in routeprovider while configuration in angularjs.

example:

angular.module('app', ['ngroute']) .config(function($routeprovider, $locationprovider) {     $locationprovider.html5mode({         enabled: true,         requirebase: false     }).hashprefix('!');     $routeprovider     .when('/index.php?comment=hello',{         redirectto:'/index.php'     });  

you can this:

your url like:

http://www.heycodetech.com/#/viewpage/param1/param2 

here router file have code:

$stateprovider.state('/viewpage/:param1/:param2', {    templateurl: 'partials/partial1.html',    controller: 'myctrl' }); 

and here code of controller can value.

.controller('myctrl', ['$scope','$routeparams', function($scope,$stateparams, $state) { var param1 = $state.param1; var param1 = $state.param2; }]); 

for more here.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -