Skip to content

Instantly share code, notes, and snippets.

@imbolc
Last active March 25, 2019 07:02
Show Gist options
  • Save imbolc/e29205d6901d135c8c1bd8c3eec26d67 to your computer and use it in GitHub Desktop.
Save imbolc/e29205d6901d135c8c1bd8c3eec26d67 to your computer and use it in GitHub Desktop.
`bind:group` does not work with nested components
{#each menu as flavour}
<Flavour {flavour}/>
{/each}
<script>
import Flavour from "./Flavour.svelte"
let menu = [
'Cookies and cream',
'Mint choc chip',
'Raspberry ripple'
];
</script>
<label>
<input type=checkbox bind:group={$flavours} value={flavour}>
{flavour}
</label>
<script>
import { flavours } from "./stores.js"
export let flavour
</script>
{
"svelte": true
}
import { writable } from 'svelte/store';
export const flavours = writable([]);
flavours.subscribe(console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment