Skip to content

state definition - non-url params require url to be defined #2025

Closed
@fgarit

Description

@fgarit

Hi,

I am using the state params property to define non-url params as such:

$stateProvider
        .state('site', {
          abstract: true,
          // url: '', // try uncommenting this line ----------------------------
          template: '<ui-view/>',
          params: {
            siteParam: null,
          },
        })
        .state('site.home', {
          url: '/home',
          templateUrl: 'tpl.html'
        })
        .state('site.page', {
          url: "/page",
          templateUrl: 'tpl.html'
        });

The problem is that the siteParam will only be populated, if the url is defined.

I don't know if this is by design. I can't really tell from reading the doc.

I've done a plunkr to illustrate:
http://plnkr.co/edit/o9ZfAAvF1eQBIcVa7BNg

If you uncomment line 14 in script.js, you'll see the siteParam is populated.

This is actually not a big deal for me, since setting:

{
  ...
  abstract: true,
  url: '',
  ...
}

works fine for my needs.

Thanks,

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions