Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I need to have two optional parameter passed by url using the query string, I was able to reach this using ui-router ( plunker ) but is not working in mine application based on angular-permission for handling Authorization.

My stateChangeStart, stateChangeError and stateChangeSuccess are almost empty (I have only logs) since the permission is handled directly from the angular-permission library.

the state definition where i need this parameter is:

 $stateProvider
         .state('schedule', {
              url: "/schedule?param1&param2",
              views: {
                        'header': {
                            templateUrl: "common/partials/header.tpl.html",
                            controller: "HeaderCtrl"
                          },'content': {
                             templateUrl: "schedule/partials/schedule.tpl.html",
                             controller:"ScheduleRecapCtrl"
                      }
              },
               resolve:{
                     Filters:'Filters',
                          availableFilters:function(Filters){
                                  return Filters.get().$promise;
                      }
               }, data: {
                         permissions: {
                              only: ['logged'],
                              redirectTo: 'login'
                          }
                }
              })

this is mine groups definition

 app.run(function (PermissionStore, authenticationSvc) {
    // Define anonymous permission
    PermissionStore.definePermission('anonymous', function(stateParams){
            return !authenticationSvc.isLogged();
    });
    PermissionStore.definePermission('logged', function (stateParams) {
            return authenticationSvc.isLogged();
    });

I noted that after reaching the state with the parameters a new $stateChangeStart is triggered (before the $stateChangeSuccess) but without the parameters that comes from the url. I don't know if there are mistake in the state definition or if the angular-permission is doing something not correct.

this is the dependencies section of my bower.json file

"dependencies": {
 "angular": "~1.4.0",
 "angular-bootstrap": "~1.1.2",
 "angular-loader": "~1.4.0",
 "angular-mocks": "~1.4.0",
 "angular-route": "~1.4.0",
 "angular-ui-router": "~0.2.17",
 "html5-boilerplate": "~5.2.0",
 "angular-animate": "^1.4.9",
 "angular-permission": "^2.0.1",
 "bootstrap": "^3.3.6",
 "startbootstrap-sb-admin-2": "^1.0.8",
 "angular-filter": "^0.5.8",
 "angular-block-ui": "^0.2.2",
 "angular-resource": "^1.5.0",
 "angular-local-storage": "^0.2.3",
 "angular-toastr": "^1.7.0",
 "angular-translate": "^2.9.1",
 "angular-sanitize": "^1.5.0",
 "angular-translate-storage-local": "^2.9.1",
 "angular-cookies": "^1.5.0",
 "angular-translate-loader-static-files": "^2.9.1"
}
share|improve this question
    
Are you asking about query parameters or permissions here, it isn't clear. Where is your $stateChangeStart code? Its usually in there where you would look at a state's data to determine if permission is required, then perform some action. – BBauer42 Feb 18 at 20:13
    
I'm using the angular-permission for handling the authentication, my $stateChangeStart code is almost empty (I have only logs inside), I will edit the question adding this detail. – JcBobo Feb 19 at 8:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.