dart - Template data binding -


i'm trying create custom element data binding.

here custom element template:

<link rel="import" href="packages/paper_elements/paper_shadow.html"> <link rel="import" href="packages/polymer/polymer.html">  <polymer-element name="tweet-element">    <template>     <link rel="stylesheet" href="tweet_element.css">      <paper-shadow z="1">       <div id="header" horizontal layout>         <div id="user-image">           <img _src="{{profileimage}}">         </div>         <div id="user-details" flex>           <div horizontal layout>             <div id="name">{{name}}</div>             <div id="screen-name">(@{{screenname}})</div>           </div>           <div id="date-published">{{date}}</div>         </div>       </div>        <div id="content">         <div id="text">{{text}}</div>       </div>     </paper-shadow>   </template>    <script type="application/dart" src="twitter.dart"></script>  </polymer-element> 

twitter.dart

import 'dart:html'; import 'package:polymer/polymer.dart'; import 'package:polymer_expressions/polymer_expressions.dart';  @customtag('tweet-element') class tweetelement extends polymerelement {   @observable string profileimage;   @observable string name;   @observable string screenname;   @observable string date;   @observable string text;    tweetelement.created() : super.created();    factory tweetelement() => new element.tag('tweet-element'); } 

this how i'm creating , adding elements:

main.dart

import 'dart:html'; import 'package:polymer/polymer.dart'; import 'package:polymer_expressions/polymer_expressions.dart'; import 'twitter.dart';  void main() {   ...    var maincontent = queryselector('#main-content');   var element;   (var tweet in tweets) {     element = new tweetelement();     element       ..profileimage = tweet.user.profileimage       ..name = tweet.user.name       ..screenname = tweet.user.screenname       ..date = _parsedate(tweet.date)       ..text = tweet.text;      maincontent.children.add(element);   } } 

the tweet-element elements , being added dom, fields data binding blank:

chrome dom

there no problem tweet objects, because i've tried setting element fields other strings , didn't work.

if have custom main method in polymer.dart application, need take care of polymer initialization yourself.
see how implement main function in polymer apps more details.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -