Skip to content

Instantly share code, notes, and snippets.

@shailen
Last active August 29, 2015 14:06
Show Gist options
  • Save shailen/8eee4626f85f56ecb1e5 to your computer and use it in GitHub Desktop.
Save shailen/8eee4626f85f56ecb1e5 to your computer and use it in GitHub Desktop.
my_element.html
---------------
<link rel="import" href="packages/polymer/polymer.html">
<link rel="import" href="packages/core_elements/core_selector.html">
<polymer-element name="my-element">
<template>
<style>
.core-selected {
font-weight: bold;
}
</style>
<core-selector id="selector" selected="1">
<template repeat="{{color in colors}}">
<div value="{{color}}">{{color}}</div>
</template>
</core-selector>
<hr>
<!-- Prints the selected index, but does not update -->
<div>{{$['selector'].selected]}}</div>
</template>
<script type="application/dart" src="my_element.dart"></script>
</polymer-element>
my_element.dart
---------------
library web.forms.selecting_one_item_using_the_core_selector_element;
import 'package:polymer/polymer.dart';
@CustomTag('my-element')
class MyElement extends PolymerElement {
final List<String> colors = toObservable(['red', 'green', 'blue']);
MyElement.created() : super.created();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment