Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$stateParams getting null after page refresh

Tags:

angularjs

When passing $stateParams through $state.go it is getting correctly when i click the link directly, but getting null after page refresh or open through another window.

I have the following function:

$scope.urlvalues = function(url,page) {
    var result = {url:url, page:page};
        $state.go("detailpage", result);
}

And my state looks like this:

.state('detailpage', {
            url: "/page/overview",
            templateUrl: "/page_details.html",
            controller: "PageDetailsController",
            params: {
                    url: null,
                    page: null
                    },         
        })

Thanks in advance.

like image 300
surya s rajan Avatar asked Aug 13 '15 04:08

surya s rajan


1 Answers

Can you try:

.state('detailpage', {
        url: "/page/overview/:url/:page",
        templateUrl: "/page_details.html",
        controller: "PageDetailsController",

    })

Then, when you go to the page the url will be set and will be there when you refresh.

like image 179
Tj Gienger Avatar answered Oct 22 '22 19:10

Tj Gienger