Skip to content

ui-router route controller executes twice when using array of query parameters #1511

Closed
@jrzerr

Description

@jrzerr

I am using an array of query parameters and finding that my route controller executes twice. So /route/1?test=2 executes route controller once as expected, but /route/1?test=2&test=3 executes the route controller twice.

Plunker to reproduce the bug

In short:

A route configured like:

$stateProvider
  .state('route', {
      url: "/route/:routeid?test",
      templateUrl: "route.html",
      controller: function($scope,$stateParams){
          console.log('route ctrl',$stateParams)
      }
  })
});

From my main controller, when I do a $state.go('route', {routeid: "1", test: ""}); or $state.go('route', {routeid: "1", test: "2"}); the route controller executes once.

When I use an array parameter, like $state.go('route', {routeid: "1", test: ["2", "3"]}); the route controller executes twice.

Is this the expected functionality, or is it a bug? If it is expected, I'd like to understand why.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions