2

I am working through the dart todo sample application. I haven't changed any code but I see lots of squiggles in the editor.

    <polymer-element name="simple-router">
        <script type="application/dart;component=1" 
         src="simple_router.dart"></script>
    </polymer-element>

The error I'm seeing reads.

Wrong script type, expected type="application/dart".

I don't understand what this means. When I strip off the ;component=1. It really breaks the application.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
mac10688
  • 2,145
  • 2
  • 24
  • 37

1 Answers1

1

This is code that was valid in Polymer about ">= 0.10.5 <0.11.0" but there were several changes.

;component=1 Should be remove from all script tags.

The imports and script tags in the entry page should look like

<html>
  <head>
    <title>core-ajax-dart</title>

    <!-- when the project uses polymer -->
    <!-- <script src="packages/web_components/platform.js"></script>
         not necessary anymore with Polymer >= 0.14.0 -->
    <script src="packages/web_components/dart_support.js"></script>

    <!-- import individual polymer elements -->
    <link rel='import' href='packages/core_elements/core_ajax_dart.html'>
  </head>
  <body>
    <core-ajax-dart
      url="http://gdata.youtube.com/feeds/api/videos/"
      params='{"alt":"json", "q":"chrome"}'
      handleAs="json"
      auto></core-ajax-dart>

    <!-- if you have a custom script file that contains a main() method -->
    <script type="application/dart" src="core_ajax_dart.dart"></script>

    <!-- else if you don't have a custom script file with a main() method 
    <script type="application/dart">export 'package:polymer/init.dart';</script>
  </body>
</html>

see here how to implement a custom main method. how to implement a main function in polymer apps

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567