Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow view targeting to specify view on the current state #25

Closed
christopherthielen opened this issue Jan 10, 2017 · 1 comment
Closed

Comments

@christopherthielen
Copy link
Member

Named views currently target the parent state

views: {
  "foo": SomeComponent
}

The above is sugar for targeting foo at the parent state, i.e.:

views: {
  "foo@^": SomeComponent
}

We can also relatively target ui-views in the ancestors by adding on additional carets ^.^

views: {
  "foo@^.^": SomeComponent
}

Layout states

Consider a LayoutComponent that renders like:

<div id="layout">
  <ui-view name="header"></ui-view>
  <ui-view name="body"></ui-view>
  <ui-view name="footer"></ui-view>
</div>

Sometimes it may be useful to define a layout in a state, and also fill in the layout in that same state. However, a config like this will target the header@^ (at the parent state):

views: {
  $default: LayoutComponent,
  header: HeaderComponent,
}

Of course, you could target the ui-view using fully qualified state name

views: {
  $default: LayoutComponent,
  "header@fully.qualified.state": HeaderComponent,
}

But it might be nice to have a shorthand for "target a view on the current state":

views: {
  $default: LayoutComponent,
  "header@.": HeaderComponent,
  "body@.": BodyComponent,
  "footer@.": FooterComponent,
}
@scipper
Copy link

scipper commented Sep 5, 2018

"viewName@." saved my day. Did not know that this one exists! 🤷‍♂️ thanks for the hint @christopherthielen 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants