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¶m2",
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"
}