dart-polymer

Custom elements not detecting children when instantiated in template of another custom element

放肆的年华 提交于 2019-12-08 03:31:32
I have an RPG Main HTML Element defined as follows. I'm instantiating it in the body of my index.html file. <link rel="import" href="packages/polymer/polymer.html"> <link rel="import" href="gridlayout.html"> <link rel="import" href="gridtile.html"> <polymer-element name="rpg-main" attributes=""> <template> <style> grid-tile { background: #FF00FF; width: 50px; height: 50px } :host { position: absolute; display: block; width: 500px; height: 500px; } </style> <grid-layout rows = "2" cols = "2" spacing = "50px"> <grid-tile> </grid-tile> <grid-tile> </grid-tile> <grid-tile> </grid-tile> <grid-tile>

why am I getting type error on polymer.dart element?

匆匆过客 提交于 2019-12-07 22:31:01
问题 I have some code: // main.dart: void main{ initPolymer(); var view = new ChatAppConsumer(); } //chat_app.dart @CustomTag('chat-app') class ChatApp extends PolymerElement{ ChatApp.created():super.created(); } class ChatAppConsumer{ final ChatApp view = new Element.tag('chat-app'); } as far as I can tell I have all my files properly referenced and Im calling initPolymer(); before I attempt to create my custom tag, but I get the type error that the HtmlElement returned by new Element.tag('chat

In polymer-dart how do I count inside a repeating template

血红的双手。 提交于 2019-12-07 17:17:03
问题 Say I've got a repeating template: <template bind repeat id='my-template'> This is the bound value: <span id="#myid[x]"> {{}} </span> </template> what can I replace [x] with that will be unique? Access to the loop counter would do the trick, but I'm open to suggestions. 回答1: I'm adding some utilities to Fancy Syntax (Polymer.dart's default binding syntax now) to help with this, but the basic outline is to run your collection though a filter that will add indices and return a new Iterable.

Numeric for loop in Dart Polymer templates

孤人 提交于 2019-12-07 16:56:04
问题 How do I write a numeric for loop in a polymer custom element template? I mean something like <template repeat="{{for i = 1 to 10}}"> <div>item</td> </template> Is it possible in the current version of Dart 1.0? 回答1: Currently no, this is not possible in Polymer.dart (or Polymer.js to my knowledge). The repeat binding requires an iterable (See Repeating Templates section of the Polymer_expressions library). Unfortunately due to Issue 12669 it is also not possible to use a list literal to

Creating a dataList programmatically

£可爱£侵袭症+ 提交于 2019-12-07 15:24:14
问题 I am trying to create a table programmatically where one of the cells contains a datalist. Below is the snippet @CustomTag( 'phone-form') class PhoneForm extends PolymerElement { @observable List<String> providers = [ '', 'AT&T', 'Digicel', 'Flow', 'Lime' ]; @observable List<String> phones = ['', 'Car', 'Call-back', 'Fax', 'Home', 'Home Fax', 'Home Mobile', 'Home Video', 'Mobile', 'Pager', 'Work', 'Work Direct', 'Work Fax', 'Work Mobile', 'Work Video', 'Next-of-Kin Home', 'Next-of-Kin Mobile'

How to access light DOM in Polymer.dart?

自闭症网瘾萝莉.ら 提交于 2019-12-07 13:51:20
问题 I'm looking for a way to access light DOM inside a custom Polymer.dart element. my_element.html <link rel="import" href="../../../../packages/polymer/polymer.html"> <polymer-element name="my-element"> <template> <content></content> </template> <script type="application/dart" src="my_element.dart"></script> </polymer-element> my_element.dart import 'package:polymer/polymer.dart'; import 'dart:html'; @CustomTag('my-element') class MyElement extends PolymerElement { MyElement.created() : super

polymer dart vs polymer js: does it matter when using the component?

好久不见. 提交于 2019-12-07 09:18:06
问题 I want to build a polymer component. I can build it using Javascript. I can build it using Dart. For the person using it (me, someone else), does it make a difference or is the polymer packaging hiding all the magic inside? 回答1: When you build it in JavaScript you should be able to use it in Dart. There are some problems and it might need some manual tweaking to make it work. This is work in progress and will become easier soon (for example bower support for Darts pub ). There is a package

How to subscribe to change of an observable field

风格不统一 提交于 2019-12-07 03:28:58
问题 until lately I could use bindProperty like shown below or in this question, but that has changed with 0.8.0 and I don't know how to change my code to get the old behaviour (doSomething() gets called): <polymer-element name="my-login" attributes="model"> <template> <template if="{{"model.isLoggedIn}}"> ... </template> </template> <script type= ... ></script> </polymer-element> . @CustomTag("my-login") class MyLogin extends PolymerElement with ObservableMixin { LoginModel model; @override

bwu_datagrid setColumns dynamically deforms while running as JS

梦想与她 提交于 2019-12-06 15:30:10
I was able to dynamically update the columns/data by using something like this: void setDV(List<Column> cols, List<DataItem> datum) { print('setColnData cols.length: ${columns.length}, datum.length: ${data2.length}'); this.data2.clear(); print("--1: ${data2.length}"); if(this.columns.length < 1){ this.columns = cols; grid.setColumns = columns; } datum.forEach((e) => this.data2.add(e)); print("--2: ${data2.length}"); grid.invalidate(); } Which works in Chromium flawlessly as a Dart app. I'm able to pass new columns with different renderers, properties, etc. But, If I run my project as JS, it

Is imperative Mustache-Binding in Polymer.dart supported?

こ雲淡風輕ζ 提交于 2019-12-06 13:20:33
问题 imperatively i am not able to get a mustache-binding to work in a polymer.dart component: ... @observable String data = "testData"; ... ready() { Element container = this.shadowRoot.querySelector("#container"); DocumentFragment newFragement = this.createFragment("<sample-element myAttribute='{{data}}'></sample-element>"); container.nodes.add(newFragement); } the mustache binding is not interpreted, a workaround i found is this one, but i dont know if this is the preferred way to do it and the