Skip to content

Instantly share code, notes, and snippets.

@vsheyanov
Created April 14, 2015 11:18
Show Gist options
  • Save vsheyanov/8ef3ca894610d5aa7760 to your computer and use it in GitHub Desktop.
Save vsheyanov/8ef3ca894610d5aa7760 to your computer and use it in GitHub Desktop.
@HtmlImport issue (working example)
import 'package:polymer/polymer.dart';
import 'data_vo.dart';
@CustomTag('child-component')
class ChildComponent extends PolymerElement{
@published DataVO selectedValue;
ChildComponent.created() : super.created(){
}
@ObserveProperty('selectedValue')
void onValueChange(){
print(selectedValue.runtimeType.toString());
}
}
<polymer-element name="child-component">
<template>
Value: {{selectedValue.label}}
</template>
<script type="application/dart" src="child_component.dart"></script>
</polymer-element>
import 'package:observe/observe.dart';
class DataVO extends Object with Observable{
@observable String label = "VVV";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer-Customer-Care</title>
<link rel="import" href="child_component.html">
<link rel="import" href="parent_component.html">
</head>
<body>
<parent-component></parent-component>
<script type="application/dart">
import 'package:polymer/polymer.dart';
main () => initPolymer();
</script>
</body>
</html>
import 'package:polymer/polymer.dart';
import 'data_vo.dart';
@CustomTag('parent-component')
class ParentComponent extends PolymerElement{
@observable DataVO selectedValue;
ParentComponent.created() : super.created(){
selectedValue = new DataVO();
}
}
<link rel="import" href="child_component.html">
<polymer-element name="parent-component">
<template>
<child-component selectedValue="{{selectedValue}}"></child-component>
</template>
<script type="application/dart" src="parent_component.dart"></script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment