AngularJS : How to use $state.go to pass querystring in nested state routing
Asked Answered
S

1

14

How can I use $state.go to pass a query string into nested state routing?

Code:

 .state('masterform', {
        url: "/masterform?action&assetId&contentTypeId&folderid",
                views: {
                    content: {
                        templateUrl: 'components/masterform/masterform.html',
                        controller: 'masterformCtrl as masterform'
                    }
                }
            })
            .state('masterform.access', {
                url: "/access",
                views: {
                    content: {
                        templateUrl: 'components/masterform/access/access.html',
                        controller: 'accessCtrl as access'
                    }
                }
            })

Thanks.

Synchrotron answered 10/3, 2015 at 14:47 Comment(0)
N
21

You can simply pass query string parameters with second option of $state.go(). Like:

$state.go('masterform', {action:'Get', assetId:1234, folderId:999});
Nigro answered 5/6, 2015 at 6:53 Comment(1)
please note that you will probably need to update application $stateProvider, like: $stateProvider.state('Get', { params: { assetId: -1, folderId: -1}}).Norvall

© 2022 - 2024 — McMap. All rights reserved.