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

<select> @bind @loop #24

Closed
celeg opened this issue Mar 28, 2022 · 2 comments
Closed

<select> @bind @loop #24

celeg opened this issue Mar 28, 2022 · 2 comments

Comments

@celeg
Copy link

celeg commented Mar 28, 2022

How work bind and loop into select (and get value of option selected) and we have access to increment number of loop ?

i try this https://codesandbox.io/s/lemonadejs-select-loop-hux4o9?file=/index.html

@hodeware
Copy link
Contributor

You can do something like that:

  let template = `<>
    <select @bind='self.value' @loop='self.options'>
      <option value='{{self.id}}'>{{self.name}}</option>
    </select>    
    <br />
    <small>{{self.value}}</small>
  </>`;

To get the incremental number of loop, you can use indexOf(self).

@celeg
Copy link
Author

celeg commented Mar 29, 2022

i have change the code in the previews link, Okay, but can you show me for the indexOf and add selected attribute, how to implement this in the template ?

https://codesandbox.io/s/lemonadejs-select-loop-forked-tvn91c?file=/src/App.js

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