Skip to content

Instantly share code, notes, and snippets.

@vsheyanov
Created April 14, 2015 11:14
Show Gist options
  • Save vsheyanov/349d8210f566b80b5e25 to your computer and use it in GitHub Desktop.
Save vsheyanov/349d8210f566b80b5e25 to your computer and use it in GitHub Desktop.
@HtmlImport issue 1 (doesn't work)
@HtmlImport('child_component.html')
library com.polymertest.childcomponent;
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>
</polymer-element>
library polymertest.datavo;
import 'package:observe/observe.dart';
class DataVO extends Object with Observable{
@observable String label = "VVV";
}
import 'parent_component.dart';
import 'child_component.dart';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer-Customer-Care</title>
</head>
<body>
<parent-component></parent-component>
<script type="application/dart">
import 'imports.dart';
import 'package:polymer/polymer.dart';
main () => initPolymer();
</script>
</body>
</html>
@HtmlImport('parent_component.html')
library com.polymertest.parentcomponent;
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();
}
}
<polymer-element name="parent-component">
<template>
<child-component selectedValue="{{selectedValue}}"></child-component>
</template>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment