问题
I have some working dart polymer code that shows a google map with some markers on it. It took me a while to get those to show up, as it seems the initialization routines are a bit wonky and it's as if sometimes there is not enough time to load the map div before it tries to render. Anyway, as I said I got that working. Now I wanted to put a core-scaffold around it, as they do on many demos. The minute I add this line...
<link rel="import" href="packages/core_elements/core_scaffold.html">
...the whole thing breaks, i get the console error:
Exception: Class 'GElement' has no instance method '[]'.
NoSuchMethodError: method not found: '[]'
Receiver: Instance of 'GElement'
Arguments: ["maps"]
I commented out all other lines and reduced it to just that one.
回答1:
(As of today), using DartEditor 1.5.8 and upgrading to polymer 0.12.0
dependencies:
polymer: '>=0.12.0 <0.13.0'
this upgrades core_element and paper_element to 0.1.x (was 0.0.x before). This now looks fixed (although there seems to be still issues with icon by ids) and I'm able to run a simple scaffold example (https://github.com/dart-lang/core-elements/blob/master/example/core_scaffold.html). you might want to give it another try!
回答2:
I once ran into a very similar error message when I first tried to use google_maps and eventually figured out that the problem was that I was missing this line in my index.html.
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
来源:https://stackoverflow.com/questions/24984742/import-polymer-core-scaffold-breaks-google-maps