I don't know much about how to use servletResponse
, but from the setHeader
method's name, you are trying to set a header value, not a parameter value.
There are couple of ways you can resolve a parameter with ui-router
(i'm assuming you are using ui-router
). You can check this link for more details on that, but here are some ways:
If you decide to go with servletResponse.sendRedirect("http://xxxxx/yyyy/#!/about/something");
, you can do something like this:
.state('about', {
url: '/about/:type', //or even url: '/about/{type}'
controller: 'AboutCtrl',
templateUrl: 'views/about/about.html'
});
function AboutCtrl($stateParams){
console.log($stateParams.type); //something
}
If you want to use query parameters servletResponse.sendRedirect("http://xxxxx/yyyy/#!/about?type=something");
, you should match your state's URL with url: '/about?type'
.
If you want to use parameters without defining them in your state's url
, you can do something like this:
.state('about', {
url: '/about/',
params: {
type: null
},
controller: 'AboutCtrl',
templateUrl: 'views/about/about.html'
});
function AboutCtrl($stateParams){
console.log($stateParams.type); //something
}
You can find more details and variations in the provided link.