ui-router icon indicating copy to clipboard operation
ui-router copied to clipboard

$state.href returns incorrect URL with custom type object

Open nairabhijit opened this issue 10 years ago • 2 comments

I have a route with custom type applied on it

$stateProvider.state('root.projects', {
   url: "projects/{filterPath:nonURIEncoded}",
   params: {
       filterPath: {
           value: null,
           squash: true
       }
   }
})

The purpose of the custom type "nonURIEncoded" is to treat the trailing slashes in state parameter as the valid url parameter

Below code gives me incorrect output

$state.href("root.projects", {
     filterPath: "computer-engineering/"
}, {                    
  absolute: true
});

Expected Output: http://localhost/projects/mechanical-engineering/ Output i am getting: http://localhost/projects/electronics-engineering%2F

It seems state.href encodes the URL parameters and doesn't apply custom type object given to particular ui-state param.

nairabhijit avatar Mar 29 '16 07:03 nairabhijit

Yeah its an ongoing issue. There are a few tickets open already that is similar to this. For now, can you just not use the /?

eddiemonge avatar Apr 08 '16 20:04 eddiemonge

Well, I needed a generic solution for the issue, above given example is just one of the scenario, I am looking for a solution in which i get a URL having custom type applied to it if applicable.

nairabhijit avatar Apr 09 '16 06:04 nairabhijit