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

Idea: component wrapper #49

Open
knownasilya opened this issue Jan 20, 2016 · 2 comments
Open

Idea: component wrapper #49

knownasilya opened this issue Jan 20, 2016 · 2 comments

Comments

@knownasilya
Copy link
Contributor

Just thought I'd throw this out there (was think of making an addon) and see if this belongs here:

A component, something like:

{{#state-group 'stateName' identifier=model as |state|}}
  <!-- use state here  -->
{{/state-group}}

<!-- or buffered -->

{{#state-group 'stateName' identifier=model buffered=true
    onapply=(route-action 'saved')
    as |state actions|}}
  <!-- use state here  -->
  <button onclick={{action actions.apply}}>Save</button>
  <button onclick={{action actions.reset}}>Reset</button>
{{/state-group}}

Basically every time this renders you would have like a persistent state object that can be modified without having to inject or make a CP.

@stefanpenner
Copy link
Owner

I'm unsure if a single special purpose component makes sense, or using state-services in custom components that accomplish this make sense.

Although I like where this is going, It would be fun to play with this (for now) as a second add-on, as I feel we have more research todo (as you mentioned \w "idea" prefix)

@knownasilya
Copy link
Contributor Author

knownasilya commented Dec 20, 2016

on another note, maybe a helper would make more sense, e.g.

{{#each models as |model|}}
  {{list-item model=model secondary=(state-for 'my-data' model)}}
{{/each}}

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