Created
September 23, 2014 04:21
-
-
Save shailen/eb7833d1927b783efaf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<polymer-element name="my-element"> | |
<template> | |
<div on-change="{{updateSelectedColor}}"> | |
<template repeat="{{color in colors}}"> | |
<label>{{color}} | |
<input type="radio" name="colors" value="{{color}}"> | |
</label> | |
</template> | |
</div> | |
<div>{{selectedColor}}</div> | |
</template> | |
<script type="application/dart" src="my_element.dart"></script> | |
</polymer-element> | |
@CustomTag('my-element') | |
class MyElement extends PolymerElement { | |
final List<String> colors = toObservable(['red', 'green', 'blue']); | |
@observable String selectedColor = ''; | |
MyElement.created() : super.created(); | |
void updateSelectedColor(Event e, Object detail, Node sender) { | |
selectedColor = (e.target as InputElement).value; | |
} | |
} | |
// This is the exception I get when I select a radio. The `value="{{color}}"` inside the `<input>` is where the problem is. | |
Exception: Uncaught Error: Error evaluating expression 'color': Class 'MyElement' has no instance setter 'color='. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment