My router looks like that:
.state(\'project\', {
\'url\': \'/project/*path\',
\'controller\': \'ProjectController\',
\'templateUrl\':
To resolve this problem you can change a state by using $location.path(), which has slashes in stateparams
. For example if our state is like this:
app.js
.state('project', {
'url': '/project/*path',
'controller': 'ProjectController',
'templateUrl': '/pages/project.html',
});
In this case path
param may contains multiple slashes .If path=part1/part2 then you get route like this /project/part1%252Fpart2
by using ui-sref
or $state.go()
. So to get correct routing (i.e. /project/part1/part2
), use $location.path() to change a state.
HTML:
{{label}}
Controller :
$scope.goToMyState = function () {
var path = '/part1/part2'
$location.path('/project' + path);
};