dart-polymer

Is imperative Mustache-Binding in Polymer.dart supported?

假装没事ソ 提交于 2019-12-04 19:47:23
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 downside is that i cannot use the mustache-binding imperatively than: Element newElement = new Element

How to embed a jquery ui widget into a polymer-dart webcomponent

泪湿孤枕 提交于 2019-12-04 16:58:38
I try to embed a jquery ui widget, f.e. a datepicker into a polymer-dart webcomponent. The Webcomponent is defined like that: <polymer-element name="my-datepicker"> <template> <div id="datepicker"></div> </template> <script type="application/dart" src="clickcounter.dart"></script> </polymer-element> The initialisation of this widget is done in JS like that <script> $(function() { $( "#datepicker" ).datepicker();}); </script> How can I initialize that widget in dart in my polymer.dart webcomponent. I tried with 'dart:js' to call that method, but I cannot access the shadow dom with dart:js. With

How to register a PolymerExpression filter inside a custom element, in Polymer.dart?

↘锁芯ラ 提交于 2019-12-04 14:35:48
How do I register a PolymerExpression filter inside a custom element? I am using Polymer.dart. I want to use this: <div>Uppercase: {{bob.fullName | uppercase}}</div> inside the template of my custom element. Where do I register uppercase ? Ageo I tried Seth answer and the expressions themselves are working but somehow I am losing events on my component. My on-click event was not working anymore when I was using: DocumentFragment instanceTemplate(Element template) => template.createInstance(this, new PolymerExpressions(globals: { 'uppercase': (String input) => input.toUpperCase() })); I also

How can I listen for changes to properties on objects inside a list, with polymer-dart?

蓝咒 提交于 2019-12-04 12:22:22
问题 I have a list of objects (for example, people), and I dynamically add and remove from the list. I want to run a query across the list when a certain property changes on any item in the list. For example, I want to know if any object in the list has its "signedAgreement" property changed. I don't want to manually attached listeners to each object, I just want to ask the list. How can I do this? My code: library my_element; import 'package:polymer/polymer.dart'; import 'dart:html'; import

How to deploy a Dart Polymer app to Javascript using dart2js

こ雲淡風輕ζ 提交于 2019-12-04 10:20:31
I got a problem while deploying Dart code using Polymer to Javascript. I've created a polymer application with DartEditor and made a simple example. This example works in Dartium but when I try to build it as a Polymer App (in Javascript) and launch it, the app fails. How am I supposed to convert a Dart Polymer app to Javascript ? Here's the example code I made that fails : example.html : <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example</title> <link rel="import" href="example-polymer.html"> <script type="application/dart">export 'package:polymer/init.dart';</script> <script

Autosizing canvas inside a polymer grid layout

断了今生、忘了曾经 提交于 2019-12-04 04:08:39
问题 I have a component that's laid out using polymer-grid-layout which contains a canvas as the main part of the content. I want the canvas to auto resize based on the size that polymer-grid-layout allocates. I can't put width:100%; height:100% on the canvas as that just stretches the canvas making it distorted and grainy. Instead I wrapped a div around the canvas and manually resize the canvas based on the div size in code. Code looks somewhat like (note I've left out the boiler plate like etc)

When to use on-click or on-tap w/ Polymer?

只愿长相守 提交于 2019-12-03 23:33:40
问题 I've researched a lot but still haven't found a good answer. When should I use on-click and when on-tap , specifically w/ Polymer? This guide focuses on programmatic event listeners, so isn't helpful in that regard: https://www.polymer-project.org/docs/polymer/touch.html 回答1: Use on-tap all the time, because the semantics of on-tap are better aligned with mobile devices than on-click . For example, on-click does not fire if another finger is touching the screen, or if the element directly

polymer dart input binding int properties

家住魔仙堡 提交于 2019-12-03 23:15:32
问题 What is the proper way of binding an input field to an int property on an object (e.g. input box changes and updates int property of an object causing another element who is binding to the same property to update) Example code is below; I may be thinking the wrong way going this route but need some clarification. <!-- index.html --> <!DOCTYPE html> <html> <head> <link rel="import" href="components/calc.html"> <script type="application/dart">export 'package:polymer/init.dart';</script> <script

I have greek text on a String in Dart using Polymer, why is it displayed wrongly on the browser?

末鹿安然 提交于 2019-12-03 21:37:49
I have the following String on my Dart code, using Polymer: @observable String title = "Καλώς Ήρθατε Ξανά!"; But this is what I see on the browser: Καλώς ΉÏθατε Ξανά! What am I missing ? When the text uses the regular Latin chars, everything is perfect. Thank you in forward Try this: Import: import 'dart:convert' show UTF8; Code: List<int> encoded = UTF8.encode('Καλώς Ήρθατε Ξανά!'); @observable String title = UTF8.decode(encoded); Short Code: @observable String title = UTF8.decode(UTF8.encode('Καλώς Ήρθατε Ξανά!')); This should encode your string as UTF8 so it shows up properly

Import and make use of Polymer-Dart 1.0.0 release candidate

别等时光非礼了梦想. 提交于 2019-12-03 17:29:16
I do love Polymer - and I do love Dart. And the Polymer-Dart library was pretty much the best thing ever happend to Web development (imho). Polymer 1.0 has been released a while ago and Googlers are working hard to build the corresponding Dart wrapper as stated in Dart's Web Development Google Group. I've built a fairly huge project quite a while ago in Polymer 0.5 and it's time to upgrade. Due to various changes in Polymer 1.0 the migration is quite hard and a lot of code breaks are expected. Since Polymer 1.0 is meant to build the final API structure for future releases, I decided to start