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

Add f-switch/f-case #20

Open
madx opened this issue Jun 23, 2020 · 0 comments
Open

Add f-switch/f-case #20

madx opened this issue Jun 23, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@madx
Copy link
Contributor

madx commented Jun 23, 2020

While f-if is useful for testing truthiness, sometimes you need to check if a variable has a specific value.

For this cases I'd like to introduce an f-switch directive that would always go with a f-case one.

I have two alternative syntaxes in mind, the former being easier to implement than the latter as it would mostly reuse the code from f-if:

<template f-switch="variable" f-case="1">
  Content when variable is 1
</template>
<template f-switch="variable" f-case="2">
  Content when variable is 2
</template>
<template f-switch="variable" f-case="3">
  Content when variable is 3
</template>

OR

<template f-switch="variable">
  <template f-case="1">
    Content when variable is 1
  </template>
  <template f-case="2">
    Content when variable is 2
  </template>
  <template f-case="3">
    Content when variable is 3
  </template>
</template>
@madx madx added the enhancement New feature or request label Jun 23, 2020
@madx madx self-assigned this Jun 23, 2020
@madx madx added this to the 1.0.0 milestone Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant