dart-polymer

Where is it best to handle the business logic in my Polymer app?

蹲街弑〆低调 提交于 2019-12-06 12:16:43
问题 So I've got a pure Polymer app. Currently, in some elements I have methods that call to my Firebase database, and handle related processing and whatnot, which I then <template repeat=...> into my element. This doesn't seem right, as it's encouraged that Polymer elements are reusable. I also do things like dependency injection e.g. <my-element app="{{app}}"> so I have access to global settings and such. What I end up with is a structure like: index.dart -> <my-app-as-an-element app=... ->

How make pub build to use source maps on dart polymer projects

依然范特西╮ 提交于 2019-12-06 10:17:21
问题 On a dart polymer project when I do a debug pub build like so: pub build --mode debug the build process does correctly produce unminified javascript with source maps for the dart code. However, the generated html file still references the .dart bootstrap script. I can always manually modify the html after the fact to use the .js file, but that's a pain. How do I get pub build to automatically generate an html file that references the debug javascript? 回答1: One solution is to add a js: true

How to use javascript from Dart inside a polymer element

末鹿安然 提交于 2019-12-06 09:48:48
I am trying to modify sample-google-maps to work inside a polymer element. On running following code I don't see anything except the title and there are no errors.Please advise how can I make this work. In longer run I want to define additional components using google-chart api and Polymer dart. Can someone point me to a worked out example. index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>DEMO</title> <script type="text/javascript" src="packages/web_components/platform.js"></script> <link rel="import"

dart vm works but dart2js fails

我的未来我决定 提交于 2019-12-06 09:46:29
问题 I am doing polymer dart. Everything works fine with dart vm but when I try to deploy it, it fails (compilation was okay.) When I run the built js version. It gave me the error Uncaught TypeError: Cannot call method 'shL' of null I tried to trace the compiled js code, and it seems like due to query an element that is not yet in the document (it is in the html file but somehow only the head of the document is loaded at that time.) Since it's the compiled version, it's really hard to trace which

How to structure a Dart application with multiple views with Polymer

╄→гoц情女王★ 提交于 2019-12-06 09:26:55
This question has been asked before but since the answer to that question Dart has adopted polymer to replace Web UI. Is there a Polymer version of the answer to this question? Also, I saw the answer relating to routes, which I like, but investigating it further has led me to believe that routes and polymer do not play well together yet. I would also like to solicit views on the new Angular-Dart since I am comfortable with Angular but see it as a competing technology to polymer at least in the Dart world. How to build a complex Web UI application with multiple views? Since Polymer is just a

Prevent paper-dialog from automatically closing

末鹿安然 提交于 2019-12-06 08:12:34
Hello: I have a paper-dialog element in a page: <paper-dialog ... id="autom_desc_dialog" autoCloseDisabled> ... <paper-button ... id="automatizar" affirmative autofocus disabled></paper-button> </paper-dialog> and I have an event listener that handles the paper-button click: var auto_btn = querySelector('#automatizar'); auto_btn.on["click"].listen((Event e) { // Some AJAX stuff }); What I want is that in some cases, to be able to prevent the dialog from closing, I've tried event.preventDefault() , event.stopImmediatePropagation() , event.stopPropagation() but no success. Thanks in advance. You

How to replace deprectaed notifyProperty?

喜欢而已 提交于 2019-12-06 07:59:32
Currently I have a getter xyz that is computed. To schedule a new computation I call notifyProperty(this, #xyz); . In the the latest version of observe , notifyProperty is deprecated. How can I replace it? The documentation suggests to use this.notifyPropertyChange(#xyz, oldValue, newValue); . The problem is, that I don't have the oldValue (and not directly the newValue ) as the getter is computed. The suggestion from the devs is to keep the oldValue around in a private variable for reference. As for the newValue you can actually just pass the getter and it will compute it with the new values.

Why do I get an Internal Dartium Exception when using custom elements?

老子叫甜甜 提交于 2019-12-06 04:58:51
I am seeing this error in my console: Exception: InvalidStateError: Internal Dartium Exception PolymerDeclaration.registerType (package:polymer/src/declaration.dart:241:22) PolymerDeclaration.register (package:polymer/src/declaration.dart:175:17) PolymerDeclaration._register (package:polymer/src/declaration.dart:114:13) PolymerDeclaration.registerWhenReady (package:polymer/src/declaration.dart:109:14) _notifyType (package:polymer/src/declaration.dart:514:49) Polymer.register (package:polymer/src/instance.dart:64:16) _loadLibrary (package:polymer/src/loader.dart:177:25) I have code like this:

HowTo add a required indicator to paper-input

*爱你&永不变心* 提交于 2019-12-06 03:29:39
Given the paper-input <paper-input floatingLabel label="Type only numbers... (floating)" validate="^[0-9]*$" error="Input is not a number!"> </paper-input> How do I add some indication that the field is required to the user. From the core-input docs https://github.com/Polymer/core-input/blob/master/core-input.html AFAIK paper-input extends core-input therefore this should apply here too: core-input also can optionally validate the value by providing it with a regular expression to match against, or a validation function. The "input-invalid" event is fired if the input value changes and is

Numeric for loop in Dart Polymer templates

 ̄綄美尐妖づ 提交于 2019-12-06 00:44:17
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? 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 accomplish this either. Using a filter we can accomplish this: <!-- myelement.html --> <polymer-element name="my